Using Linux Mint.
I have the following docker-compose.yml. When I run docker-compose up -d
it's very common that all the containers except for my web container start up, and if I run the command several more times, eventually my web container is up. There is nothing in the docker logs and no error is thrown. I'm at my wits end as to why this happens. Can someone shed some light on what else I could do in order to figure this out?
Using the same file, this also happens on Ubuntu20.04, but it is much less frequent.
version: '3'
services:
db:
container_name: db_container
image: mysql:5.6
volumes:
- dbBackup.sql:/docker-entrypoint-initdb.d/backup.sql
restart: always
environment:
MYSQL_ROOT_PASSWORD: blah
MYSQL_DATABASE: dbname
MYSQL_USER: myUser
MYSQL_PASSWORD: myPassword
ports:
- 3306:3306
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
web:
container_name: web_container
build: ./web # This is just a centos image with a few things like httpd installed.
volumes:
- ./some_dir:codebase
- ./config:codebase/config
links:
- redis
depends_on:
- db
redis:
container_name: redis
image: redis
mailhog:
container_name: mailhog
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
Dockerfile for web container:
FROM centos/centos8
RUN dnf -y update && \
dnf -y install epel-release httpd httpd-tools {more stuff}
EXPOSE 80 443
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT [ "docker-entrypoint.sh" ]
docker-entrypoint.sh:
#!/bin/bash
/usr/sbin/httpd -D FOREGROUND