Hey,
I just started learnig docker and i am trying to make a container for one of my projects. The problem that i am facing is that apt-get install inside my Dockerfile wont finish. I waited up to 20 mins and still didnt finish and since its a non interactive process i cant see what’s happening.
I am using Docker version 20.10.5, build 55c4c88 on Windows 10 Pro 64bit. Tried with both wsl2 backend and hyper-v.
There are my files:
Dockerfile
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
curl \
mc \
nano \
dialog \
sudo \
apache2 \
php7.2 \
&& rm -rf /var/lib/apt/lists/*
ADD entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod a+x /usr/bin/entrypoint.sh
ENTRYPOINT [ "entrypoint.sh" ]
docker-compose.yaml
version: "3.1"
services:
www:
build: .
ports:
- "80:80"
volumes:
- .:/var/www/workbuzz/
links:
- db
networks:
- default
db:
image: mariadb
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: workbuzzdev
MYSQL_USER: buzz
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
volumes:
- ./migration:/docker-entrypoint-initdb.d
- ./conf:/etc/mysql/conf.d
- persistent:/var/lib/mysql
networks:
- default
volumes:
persistent:
entrypoint.sh
#!/bin/bash
service apache2 start
tail -F -n0 /etc/hosts
After running docker-compose up -d the whole process runs forever when docker hits the part with the apt-get install. If i remove the php7.2 part then it will finish but still after around 5 minutes what in my oppinion is not normal. I suppose i am doing something wrong but please note that since i am just learning all this, the code posted is scavanged from multiple sources but its working. If i exclude the php7.2 part then the build finishes after around 5 minutes and everything boots up normally.
Any advice on how to speed up the build process would be most welcome.
Regards,
Trix