Answer the question
In order to leave comments, you need to log in
How to mount folder with files in docker?
Hello, I'm learning docker.
I work on macos.
Installed https://docs.docker.com/toolbox/toolbox_install_mac/ they say it works faster through it.
wrote config:
version: '2'
services:
php:
build: ./docker/php/
container_name: php
volumes_from:
- source
ports:
- '0.0.0.0:9000:9000'
links:
- mysql
- memcached
networks:
- bitrix
restart: always
web_server:
build: ./docker/nginx/
container_name: webserver
depends_on:
- source
volumes_from:
- source
ports:
- '0.0.0.0:80:80'
- '0.0.0.0:443:443'
links:
- php
networks:
- bitrix
restart: always
mysql:
build: ./docker/mysql
container_name: mysql
volumes_from:
- source
ports:
- '0.0.0.0:3306:3306'
# - 'docker.for.mac.localhost:3306'
environment:
MYSQL_DATABASE: ikea
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
command: mysqld --sql-mode=""
networks:
- bitrix
restart: always
memcached:
image: memcached:1.5-alpine
container_name: memcached
volumes_from:
- source
ports:
- '0.0.0.0:11211:11211'
networks:
- bitrix
restart: always
source:
image: alpine:latest
container_name: source
volumes:
- ./docker/logs/nginx:/var/log/nginx
- ./docker/logs/php:/var/log/php
- ./docker/logs/mysql:/var/log/mysql
- ./docker/logs/memcached:/var/log/memcached
- ./docker/data/mysql:/var/lib/mysql
- ./docker/data/memcached:/var/lib/memcached
#- ./www/html:/var/www/html
- ./code:/var/www/bitrix
#- /etc/localtime:/etc/localtime/:ro
networks:
- bitrix
networks:
bitrix:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.100.0.0/24
docker-compose up -d --build
Creating source ... done
Creating mysql ... done
Creating memcached ... done
Creating php ... done
Creating webserver ... done
docker exec -it webserver bash
Answer the question
In order to leave comments, you need to log in
You need to share the disk where the directory is mounted. This was a problem on Windows, I think for poppy you also need to share folders
web_server:
build: ./docker/nginx/
container_name: webserver
volumes:
- ./my/volume:/container/volume
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question