Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DockerFile Changes for Arm32 #883

Closed
psyciknz opened this issue Oct 23, 2018 · 23 comments
Closed

DockerFile Changes for Arm32 #883

psyciknz opened this issue Oct 23, 2018 · 23 comments

Comments

@psyciknz
Copy link

Any ideas what changes might be required for arm. The main issue seems to be finding a compatible arm32v7/6 alpine php image.

@logmanoriginal
Copy link
Contributor

Good question. I'm no Docker expert, but according to docker-library it should just auto-build for your current architecture:

As of 2017-09-12, these other architectures are included under the non-prefixed images via "manifest lists" (also known as "indexes" in the OCI image specification), such that, for example, docker run hello-world should run as-is on all supported platforms.

The current docker image is based on ulsmith/alpine-apache-php7. If you take a look into its docker file, it is based on alpine:edge, which according to their readme supports amd64, arm32v6, arm64v8, i386, ppc64le, s390x.

@psyciknz
Copy link
Author

Hmm no it definitely doesn’t pull an arm image.

For other things, especially self written python services that I’ve converted to docker, I’ve used a dockerfile with replacing architecture strings and a build script to build for amd64, arm32v7 and arm64. Then push manifests.

With rss-bridge I was stuck looking for the alpine php for arm to use as the base

@logmanoriginal
Copy link
Contributor

Hmm no it definitely doesn’t pull an arm image.

:(

For other things, especially self written python services that I’ve converted to docker, I’ve used a dockerfile with replacing architecture strings and a build script to build for amd64, arm32v7 and arm64. Then push manifests.

Took me a while to understand what you mean, but I think it's clear(er) to me now. According to my research (please correct me if I'm wrong), we need to build each architecture separately (i.e. rss-bridge:amd64-latest, rss-bridge:arm32v7-latest, etc...). Using some sort of script we can automate this process somehow (pointers please).

I'm pretty sure that ulsmith/alpine-apache-php7 doesn't support multi-arch, so maybe we need to build our own packages based on the various flavors of alpine?

i.e.

This might also be interesting: https://lobradov.github.io/Building-docker-multiarch-images/

I'm open to suggestions 😁

@psyciknz
Copy link
Author

psyciknz commented Oct 25, 2018 via email

@logmanoriginal
Copy link
Contributor

Is this still an issue?
The Dockerfile was recently updated to the official PHP image which has support for various flavors of arm: https://hub.docker.com/_/php

@psyciknz
Copy link
Author

Not sure. I've been running on amd64 since I could never get it going on arm.....even though that's where my tt-rss is on arm.

I could give it another go with the later docker file and see if I can get an arm build working.

@logmanoriginal
Copy link
Contributor

Looks like Docker Hub only builds amd64 images. Here is my attempt. Here is a post I found on the Docker forums that explains the error message: https://forums.docker.com/t/automated-build-raspberry-pi-based-image-on-docker-hub/4155/2

You should be able to build the docker image directly on your machine.
Change the first line in the Dockerfile.

FROM php:7-apache

to FROM arm32v7/php:7-apache and build the image.

@jdckr
Copy link

jdckr commented Nov 2, 2019

Looks like Docker Hub only builds amd64 images. Here is my attempt. Here is a post I found on the Docker forums that explains the error message: https://forums.docker.com/t/automated-build-raspberry-pi-based-image-on-docker-hub/4155/2

You should be able to build the docker image directly on your machine.
Change the first line in the Dockerfile.

FROM php:7-apache

to FROM arm32v7/php:7-apache and build the image.

It's working, just created a docker image for Raspberry Pi3.

@captn3m0
Copy link
Contributor

captn3m0 commented Nov 5, 2019

@jdckr Thanks for the bump. I somehow never noticed this issue.

One of my goals while setting up the initial dockerfile was to ensure public auditable builds. There seem to be some workarounds for getting arm to work on DockerHub via build hooks so I'll take a stab at this later.

@tobinstultiens
Copy link

Has there been an update on this issue since I still can't run this on my Raspberry Pi that uses ARMv7.

@jdckr
Copy link

jdckr commented Jun 22, 2020

@tobinstultiens Have you tried to build the image on your pi?

@tobinstultiens
Copy link

Yeah, it gives me this error.

standard_init_linux.go:211: exec user process caused "exec format error"

So when I have some time next week I will attempt to fix the dockerfile myself if there has been no progress.

@jdckr
Copy link

jdckr commented Jun 22, 2020

Have you updated the dockerfile? You need to change the base image to FROM arm32v7/php:7-apache?

@rastacalavera
Copy link

does anyone have a docker-compose to share? I really want to run this on my pi4

@tobinstultiens
Copy link

You just need to change the FROM in the dockerfile.

This is the dockerfile you want:

FROM arm32v7/php:7-apache

ENV APACHE_DOCUMENT_ROOT=/app

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
	&& apt-get --yes update && apt-get --yes install libxml2-dev zlib1g-dev libmemcached-dev \
	&& docker-php-ext-install -j$(nproc) simplexml \
	&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
	&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
	&& sed -ri -e 's/(MinProtocol\s*=\s*)TLSv1\.2/\1None/' /etc/ssl/openssl.cnf \
	&& sed -ri -e 's/(CipherString\s*=\s*DEFAULT)@SECLEVEL=2/\1/' /etc/ssl/openssl.cnf

RUN curl https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/v3.1.5 --output /tmp/php-memcached.tar.gz \
	&& mkdir -p /usr/src/php/ext \
	&& tar xzvf /tmp/php-memcached.tar.gz -C /usr/src/php/ext \
	&& mv /usr/src/php/ext/php-memcached-3.1.5 /usr/src/php/ext/memcached \
	&& cd /usr/src/php/ext/memcached \
	&& docker-php-ext-configure /usr/src/php/ext/memcached --disable-memcached-sasl \
	&& docker-php-ext-install /usr/src/php/ext/memcached \
	&& rm -rf /usr/src/php/ext/memcached

COPY --chown=www-data:www-data ./ /app/

I have personally tested this and it works. I don't know how to make it switchable on the basis of your operating system.

@rastacalavera
Copy link

So I am still pretty new to this but would it look something like this then?

version: '2'
services:
   rss-bridge:rssbridge/rss-bridge
    image: rssbridge/rss-bridge:latest
    volumes:
      - /opt/appdata/rss-bridge/whitelist.txt:/app/whitelist.txt
    ports:
      - 4050:80
    depends_on:
      - db
   db:
    image: arm32v7/php:7-apache
    restart: always
    environment:
      - APACHE_DOCUMENT_ROOT=/app
    onrun:
      - mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
	&& apt-get --yes update && apt-get --yes install libxml2-dev zlib1g-dev libmemcached-dev \
	&& docker-php-ext-install -j$(nproc) simplexml \
	&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
	&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
	&& sed -ri -e 's/(MinProtocol\s*=\s*)TLSv1\.2/\1None/' /etc/ssl/openssl.cnf \
	&& sed -ri -e 's/(CipherString\s*=\s*DEFAULT)@SECLEVEL=2/\1/' /etc/ssl/openssl.cnf
      - curl https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/v3.1.5 --output /tmp/php-memcached.tar.gz \
	&& mkdir -p /usr/src/php/ext \
	&& tar xzvf /tmp/php-memcached.tar.gz -C /usr/src/php/ext \
	&& mv /usr/src/php/ext/php-memcached-3.1.5 /usr/src/php/ext/memcached \
	&& cd /usr/src/php/ext/memcached \
	&& docker-php-ext-configure /usr/src/php/ext/memcached --disable-memcached-sasl \
	&& docker-php-ext-install /usr/src/php/ext/memcached \
	&& rm -rf /usr/src/php/ext/memcached
      - cp --chown=www-data:www-data ./ /app/

@jdckr
Copy link

jdckr commented Jul 12, 2020

@rastacalavera
You have to adapt the Dockerfile and built the image for the pi4 on your own.

  1. change base image in Dockerfile to support pi4 architecture: FROM php:7-apache -> FROM arm32v7/php:7-apache
    FROM php:7-apache
  2. Build Image: sudo docker build -t <name>:<tag> <path/to/repo> e.g. sudo docker build -t rss-bridge:local .
  3. setup docker-compose.yml:
version: '3'
services:
  rss-bridge:
    container_name: rss-bridge
    volumes:
      - ./whitelist.txt:/app/whitelist.txt
    image: <image_name> # e.g. rss-bridge:local from command above
    ports:
      - <host_port>:80
    restart: unless-stopped

@rastacalavera
Copy link

@jdckr thanks! I am up and running now

@rastacalavera
Copy link

Ok spoke too soon. It's running but there aren't any bridges listed. . . in the path there is a FOLDER that was made called whitelist.txt which was empty but the only txt file was called whitelist.default.txt so I actually don't have access to any bridges. Weird. . .

@Luxtech
Copy link

Luxtech commented Jan 26, 2021

Ok spoke too soon. It's running but there aren't any bridges listed. . . in the path there is a FOLDER that was made called whitelist.txt which was empty but the only txt file was called whitelist.default.txt so I actually don't have access to any bridges. Weird. . .

have to same issue there is a folder called whitelist.txt but it has no file in it. If i add a file it also does not work.

@sanpoChew
Copy link

sanpoChew commented Jun 21, 2021

is this closed by #2104 ?

EDIT: Seems to be

@Bockiii
Copy link
Contributor

Bockiii commented Dec 1, 2021

yeah @em92 can be closed

@dvikan
Copy link
Contributor

dvikan commented Mar 21, 2022

@em92 This PR can be closed.

@em92 em92 closed this as completed Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests