Can't build docker compose on M1 chipset - macos

I tried to build the docker compose on M1 chipset and getting error as such:
/remi/enterprise/7/php73/aarch64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
But in my Intel chip, I haven't encountered this problem. Apparently there are not much solutions on the internet as well. Have anyone encountered the same problem? Here is the Dockerfile that causes the problem:
FROM centos:7
WORKDIR /home/project/source
RUN yum -y install epel-release yum-utils && \
yum -y install http://rpms.remirepo.net/enterprise/remi-
release-7.rpm && \
yum-config-manager --disable remi-php54 && \
yum-config-manager --enable remi-php73 && \
yum -y install \
nginx \
jq \
php \
php-fpm \
php-cli \
php-opcache \
php-msgpack \
php-redis \
php-mbstring \
php-intl \
php-xml \
php-gettext \
php-imagick \
php-pgsql \
php-soap \
php-pdo \
php-mysqlnd \
php-apcu \
php-igbinary \
php-json \
php-memcache \
php-xdebug \
php-mysqlnd \
php-openssl \
php-opcache
RUN yum -y update && yum clean all
COPY config/php-fpm.d/www.conf /etc/php-fpm.d/www.conf
COPY config/php.d/90-project-php.ini /etc/php.d/90-project-php.ini
RUN mkdir /var/run/php-fpm && \
chmod -R 777 /var/lib/php && \
ln -sf /dev/stdout /var/log/php-fpm/access.log && \
ln -sf /dev/stderr /var/log/php-fpm/error.log
EXPOSE 9000
CMD ["php-fpm", "-F"]
It is constantly trying to find mirrors with no success.

/remi/enterprise/7/php73/aarch64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Remi's Repository is only for x86_64 architecture for now.
You can try drpixel repository (rebuild of remi's packages)
See https://repo.drpixel.fr/

Related

neo4j 4.0 testing with embedded database DatabaseManagementServiceBuilder is found nowhere

I'm a beginner in neo4j. I'm trying to build tests using embedded neo4j database inside a springboot application. I haven't succeeded since the class DatabaseManagementServiceBuilder is found nowhere Please note I'm using version 4.0.2 Any help please ?
The full classname is org.neo4j.dbms.api.DatabaseManagementServiceBuilder.
Here is a sample class that uses the builder.
I've struggled with using an embedded neo4j db for my tests a few months back as well.
In case you don't find a suitable solution for the embedded version, I ended up starting a real instance of the db...
I adjusted a bit neo4j's official Dockerfile to use jdk instead of jre and was able to run my tests against it.
Here's the Dockerfile, starting from the official 3.4.5-enterprise Dockerfile:
FROM openjdk:8-jdk-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
make && \
rm -rf /var/lib/apt/lists/*
ADD maven-settings.xml /root/.m2/settings.xml
# from official neo4j:3.4.5-enterprise image content (changed base image to use jdk instead of jre)
RUN addgroup --system neo4j && adduser --system --no-create-home --home /var/lib/neo4j --ingroup neo4j neo4j
ENV NEO4J_SHA256=0629f17a99ba90d6900c98f332c775a732cc2ad6298b8df41a2872277b19e6e3 \
NEO4J_TARBALL=neo4j-enterprise-3.4.5-unix.tar.gz \
NEO4J_EDITION=enterprise \
NEO4J_ACCEPT_LICENSE_AGREEMENT=yes \
TINI_VERSION="v0.18.0" \
TINI_SHA256="12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855"
ARG NEO4J_URI=http://dist.neo4j.org/neo4j-enterprise-3.4.5-unix.tar.gz
RUN apt update \
&& apt install -y \
bash \
curl \
&& curl -L --fail --silent --show-error "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" > /sbin/tini \
&& echo "${TINI_SHA256} /sbin/tini" | sha256sum -c --strict --quiet \
&& chmod +x /sbin/tini \
&& curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \
&& echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \
&& tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \
&& mv /var/lib/neo4j-* /var/lib/neo4j \
&& rm ${NEO4J_TARBALL} \
&& mv /var/lib/neo4j/data /data \
&& chown -R neo4j:neo4j /data \
&& chmod -R 777 /data \
&& chown -R neo4j:neo4j /var/lib/neo4j \
&& chmod -R 777 /var/lib/neo4j \
&& ln -s /data /var/lib/neo4j/data
# Install latest su-exec
RUN set -ex; \
\
curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c; \
\
fetch_deps='gcc libc-dev'; \
apt-get update; \
apt-get install -y --no-install-recommends $fetch_deps; \
rm -rf /var/lib/apt/lists/*; \
gcc -Wall \
/usr/local/bin/su-exec.c -o/usr/local/bin/su-exec; \
chown root:root /usr/local/bin/su-exec; \
chmod 0755 /usr/local/bin/su-exec; \
rm /usr/local/bin/su-exec.c; \
\
apt-get purge -y --auto-remove $fetch_deps
ENV PATH /var/lib/neo4j/bin:$PATH
ARG NEO4J_AUTH=neo4j/neo4jtest
ENV NEO4J_AUTH=${NEO4J_AUTH}
WORKDIR /var/lib/neo4j
VOLUME /data
COPY docker-entrypoint.sh /docker-entrypoint.sh
EXPOSE 7474 7473 7687
ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"]
CMD ["neo4j"]
I used the original docker-entrypoint.sh script.

Trigger executing a custom shell script inside a container to run migrations and db:seed after docker build is complete from docker-compose.yml

I have created my docker-compose.yml file to make containers for a Laravel project and I created a separate project_setup.sh script to do composer install,npm install and DB migration. is there a way to automate this like once both containers up run the sh script from inside apache server container where files are located without manually log in to the container and run the file.
my current docker-compose.yml
version: '3.5'
services:
laravel-app:
build:
context: '.'
container_name: my-app
volumes:
- ./:/var/www/html
- ./docker_configs/custom.ini:/usr/local/etc/php/conf.d/custom.ini
- ./docker_configs/laravel-worker.conf:/etc/supervisor/conf.d/laravel-worker.conf
- ./docker_configs/docker_cron:/etc/cron.d/docker_cron
working_dir: /var/www/html
ports:
- 8080:80
networks:
backend:
aliases:
- app
mariadb:
image: mariadb:10.2
container_name: my-db
volumes:
- ./run/var:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASSWORD=${DB_PASSWORD}
ports:
- 3309:3306
networks:
backend:
aliases:
- db
networks:
backend:
name: backend-network
I'm just using latest MariaDB image with database settings my docker file in case
FROM php:7.3.12-apache-stretch
RUN apt-get autoclean
RUN apt-get update
# 1. development packages
RUN apt-get install -y \
apt-utils \
build-essential \
debconf-utils \
debconf \
default-mysql-client \
locales \
git \
memcached \
zip \
sudo \
wget \
gnupg \
unzip \
nano \
libxml2-dev \
libldb-dev \
libldap2-dev \
libpq-dev \
libzip-dev \
libicu-dev \
libbz2-dev \
libpng-dev \
libjpeg-dev \
openssh-client \
libmcrypt-dev \
libreadline-dev \
libmagickwand-dev \
libmemcached-dev \
libmagickcore-dev \
zlib1g-dev \
libfreetype6-dev \
cron \
supervisor
RUN \
echo "deb http://ftp.au.debian.org/debian/ stretch main non-free contrib" > /etc/apt/sources.list && \
echo "deb-src http://ftp.au.debian.org/debian/ stretch main non-free contrib" >> /etc/apt/sources.list && \
echo "deb http://security.debian.org/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src http://security.debian.org/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \
apt-get -qq update && apt-get -qqy upgrade && apt-get -q autoclean && rm -rf /var/lib/apt/lists/*
RUN apt-get update
RUN apt-get upgrade
RUN apt-get update && apt-get install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/lists/*
# 2. apache configs + document root
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
RUN a2enmod rewrite headers
# 4. start with base php config, then add extensions
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
RUN docker-php-ext-install \
bcmath \
bz2 \
dom \
gd \
json \
ldap \
mbstring \
pgsql \
mysqli \
intl \
iconv \
opcache \
calendar \
pdo_mysql \
pdo_pgsql \
xml
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install imap
RUN docker-php-ext-configure zip --with-libzip && \
docker-php-ext-install zip
#add unsupported php files via pecl
RUN pecl install xdebug && docker-php-ext-enable xdebug && \
pecl install mcrypt && docker-php-ext-enable mcrypt && \
pecl config-set php_ini /etc/php/7.3/apache2/php.ini && \
pecl install imagick && docker-php-ext-enable imagick
RUN mkdir -p /usr/src/php/ext/memcached
WORKDIR /usr/src/php/ext/memcached
RUN wget https://github.com/php-memcached-dev/php-memcached/archive/v3.1.3.zip; unzip /usr/src/php/ext/memcached/v3.1.3.zip
RUN mv /usr/src/php/ext/memcached/php-memcached-3.1.3/* /usr/src/php/ext/memcached/
RUN docker-php-ext-configure memcached && docker-php-ext-install memcached
RUN mkdir -p /usr/src/php/ext/memcache
WORKDIR /usr/src/php/ext/memcache
RUN wget https://github.com/websupport-sk/pecl-memcache/archive/4.0.4.zip; unzip /usr/src/php/ext/memcache/4.0.4.zip
RUN mv /usr/src/php/ext/memcache/pecl-memcache-4.0.4/* /usr/src/php/ext/memcache/
RUN docker-php-ext-install memcache && docker-php-ext-configure memcache
# 6. Configure needed apache modules and disable default site
RUN a2dismod mpm_event cgi # mpm_worker enabled.
RUN a2enmod \
access_compat \
actions \
alias \
auth_basic \
authn_core \
authn_file \
authz_core \
authz_groupfile \
authz_host \
authz_user \
autoindex \
dir \
env \
expires \
filter \
headers \
mime \
negotiation \
mpm_prefork \
reqtimeout \
rewrite \
setenvif \
status \
ssl
# 7. composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install Node.js
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN node -v
RUN npm -v
maybe my approach wrong.. I appreciate any support.
Update
i created the files required for building the docker container.Hope it'll be usefull to anyone else.
https://github.com/Madu-rosh/laravel-docker-setup

Build lumen in docker

I have a problem when I build lumen on docker, but when the build process is finished there is an error like this :
E: Package 'libpng12-dev' has no installation candidate
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y libpng12-dev libjpeg-dev libpq-dev && rm -rf /var/lib/apt/lists/* && docker-php-ext-configure gd --with-png-
dir=/usr --with-jpeg-dir=/usr && docker-php-ext-install gd mbstring pdo pdo_mysql pdo_pgsql zip' returned a non-zero code: 100
So the build process fails.
Has anyone ever had a case like me? I hope someone can provide a solution.
Try libpng-dev instead of libpng12-dev, that one is deprecated and has been removed
try this in your Dockerfile
RUN apk add --no-cache php \
php7-common \
php7-fpm \
php7-pdo \
php7-opcache \
php7-zip \
php7-phar \
php7-iconv \
php7-cli \
php7-curl \
php7-openssl \
php7-mbstring \
php7-tokenizer \
php7-fileinfo \
php7-json \
php7-xml \
php7-xmlwriter \
php7-simplexml \
php7-dom \
php7-pdo_mysql \
php7-pdo_pgsql \
php7-pdo_sqlite \
php7-tokenizer \
php7-pecl-redis \
nginx supervisor curl

Docker bash file will not load

I'm new to docker and I try to build a php-fpm container which should include sendmail as well
having the following configuration
# php-fpm
FROM php:7.2-fpm
RUN apt-get update && apt-get install -y sendmail sendmail-bin mailutils openssl git libcurl4-gnutls-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev zlib1g-dev libicu-dev g++ libxml2-dev libpq-dev \
# && git clone -b php7.2 https://github.com/phpredis/phpredis.git /usr/src/php/ext/redis \
&& docker-php-ext-install pdo pdo_mysql pdo_pgsql pgsql intl curl json opcache xml zip mysqli mbstring \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& apt-get autoremove && apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* \
RUN yes | pecl install xdebug \
# configure sendmail
COPY ./*.sh /usr/local/bin/
COPY ./php_mail.ini /usr/local/etc/php/conf.d/mail.ini
RUN chmod a+x /usr/local/bin/*.sh
ENTRYPOINT ["start_sendmail_mta.sh"]
RUN update-ca-certificates
ENV PHP_DATE_TIMEZONE="Europe/Berlin" \
PHP_LOG_ERRORS_MAX_LEN=1024 \
PHP_LOG_ERRORS="" \
PHP_MAX_EXECUTION_TIME=0 \
PHP_MAX_FILE_UPLOADS=20 \
PHP_MAX_INPUT_VARS=1000 \
PHP_MEMORY_LIMIT=128M \
PHP_POST_MAX_SIZE=8M \
#PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i" \
PHP_SESSION_SAVE_HANDLER=files \
PHP_SESSION_SAVE_PATH="" \
PHP_UPLOAD_MAX_FILESIZE=2M \
PHP_XDEBUG_DEFAULT_ENABLE=0 \
PHP_XDEBUG_IDEKEY=''\
PHP_XDEBUG_PROFILER_ENABLE=0 \
PHP_XDEBUG_REMOTE_AUTOSTART=0 \
PHP_XDEBUG_REMOTE_CONNECT_BACK=0 \
PHP_XDEBUG_REMOTE_ENABLE=0 \
PHP_XDEBUG_REMOTE_HOST=0
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');"
CMD ["php-fpm"]
EXPOSE 9000
when I run docker-compose buildI get the following error
Service 'php-fpm' failed to build: The command '/bin/sh -c chmod a+x /usr/local/bin/*.sh' returned a non-zero code: 1
[![enter image description here][2]][2]
Why are the bash files not found in this case?
chmod: cannot access '/usr/local/bin/*.sh': No such file or directory
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c chmod a+x /usr/local/bin/*.sh' returned a non-zero code: 1
if I run RUN ls -l /usr/local/bin I can not see any bash files
Just change copy ./*.sh to:
COPY sendmail.sh /usr/local/bin/
COPY ./php_mail.ini /usr/local/etc/php/conf.d/mail.ini
COPY start_sendmail_mta.sh /usr/local/bin
RUN chmod a+x /usr/local/bin/*.sh

Debug Docker container exited with 0

having the following php-fpm container
# php-fpm
FROM php:7.2-fpm
RUN apt-get update && apt-get install -y sendmail sendmail-bin mailutils openssl git libcurl4-gnutls-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev zlib1g-dev libicu-dev g++ libxml2-dev libpq-dev \
# && git clone -b php7.2 https://github.com/phpredis/phpredis.git /usr/src/php/ext/redis \
&& docker-php-ext-install pdo pdo_mysql pdo_pgsql pgsql intl curl json opcache xml zip mysqli mbstring \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& apt-get autoremove && apt-get autoclean \
&& rm -rf /var/lib/apt/lists/*
RUN yes | pecl install xdebug
# configure sendmail
COPY sendmail.sh /usr/local/bin/
COPY ./php_mail.ini /usr/local/etc/php/conf.d/mail.ini
COPY start_sendmail_mta.sh /usr/local/bin
RUN ls -l .
RUN ls -l /usr/local/bin
RUN chmod a+x /usr/local/bin/*.sh
ENTRYPOINT ["start_sendmail_mta.sh"]
RUN update-ca-certificates
ENV PHP_DATE_TIMEZONE="Europe/Berlin" \
PHP_LOG_ERRORS_MAX_LEN=1024 \
PHP_LOG_ERRORS="" \
PHP_MAX_EXECUTION_TIME=0 \
PHP_MAX_FILE_UPLOADS=20 \
PHP_MAX_INPUT_VARS=1000 \
PHP_MEMORY_LIMIT=128M \
PHP_POST_MAX_SIZE=8M \
#PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i" \
PHP_SESSION_SAVE_HANDLER=files \
PHP_SESSION_SAVE_PATH="" \
PHP_UPLOAD_MAX_FILESIZE=2M \
PHP_XDEBUG_DEFAULT_ENABLE=0 \
PHP_XDEBUG_IDEKEY=''\
PHP_XDEBUG_PROFILER_ENABLE=0 \
PHP_XDEBUG_REMOTE_AUTOSTART=0 \
PHP_XDEBUG_REMOTE_CONNECT_BACK=0 \
PHP_XDEBUG_REMOTE_ENABLE=0 \
PHP_XDEBUG_REMOTE_HOST=0
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');"
CMD ["php-fpm"]
EXPOSE 9000
when I boot with docker-compose upthe container will not start. I get container exited with code 0. How can I debug this issue?

Resources