Здесь --net docknet настроен ранее на 172.18.0.0/16
§ Базовый ubuntu
FROM ubuntu:latest
§ Настроенный php+apache2
FROM ubuntu:latest ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y mc php php-mbstring php-curl php-mysql apache2 wget curl subversion git && useradd -ms /bin/bash fox EXPOSE 80/tcp CMD ["apachectl", "-D", "FOREGROUND"]
§ Makefile
build: docker build -t apache . run: docker run --net docknet --ip 172.18.0.2 -v /var/www/html:/var/www/html --name=apachecont -dt apache bash: docker exec --user=[USER] --workdir=/var/www/html -it apachecont bash start: docker start apachecont
§ MySQL
FROM ubuntu:latest ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y mc mysql-client mysql-server && \ useradd -ms /bin/bash [USER] EXPOSE 3306/tcp EXPOSE 33060/tcp
§ Crontab
DockerfileFROM ubuntu:16.04 ENV DEBIAN_FRONTEND=noninteractive ENV EDITOR=vim RUN apt-get update && apt-get install -y cron vim mc && useradd -ms /bin/bash [USER] COPY cron.txt /var/spool/cron/crontabs/root CMD ["cron", "-f"]Makefile
build: docker build -t crontest . run: docker run -dt -v ${PWD}/data:/data --name=crontest_cont crontest bash: docker exec -it crontest_cont /bin/bash