I have the following docker compose file which runs fine when I do docker-compose up
but once I restart the machine, the container php53
does not mount the content of /home/madiba/Development/docker_test/www
to `/var/www. If I restart it's mounted! This is running on Ubuntu 16.04 server. Setting up the same container on my laptop running similar version of Ubuntu runs fine.
version: '2.0'
services:
db:
image: mysql:5.5
container_name: mysql5
volumes:
- "/home/madiba/Development/docker_test/mysql55_storage:/var/lib/mysql"
ports:
- "3355:3306"
restart: always
environment:
MYSQL_ROOT_PASSWORD: pass
php53:
build: /home/madiba/Development/docker_test/php53
container_name: php53
ports:
- "5533:80"
volumes:
- "/home/madiba/Development/docker_test/www:/var/www"
depends_on:
- db
links:
- db
restart: always
environment:
display_errors: 'Off'
PHP_ERROR_REPORTING: E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED
The Dockerfile:
FROM ubuntu:12.04
MAINTAINER madiba <madiba@gmail.com>
# disable interactive functions
ENV DEBIAN_FRONTEND noninteractive
VOLUME ["/var/www"]
RUN apt-get update && \
apt-get install -y \
apache2 \
php5 \
php5-cli \
libapache2-mod-php5 \
php5-gd \
php5-ldap \
php5-mysql \
php5-pgsql \
php5-mcrypt \
php5-json \
curl \
libcurl3-dev \
php5-curl \
nano && \
rm -rf /var/lib/apt/lists/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr /local/bin --filename=composer
RUN composer --version
COPY apache_default /etc/apache2/sites-available/default
COPY run /usr/local/bin/run
RUN chmod +x /usr/local/bin/run
RUN a2enmod rewrite
EXPOSE 80
CMD ["/usr/local/bin/run"]
Your compose file does not seem to be indented correctly. The second line in the following section does not seem to have correct number of spaces at the beginning of the line. This could be an issue.
volumes:
- "/home/madiba/Development/docker_test/www:/var/www"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.