docker-volume

chown docker volumes on host (possibly through docker-compose)

筅森魡賤 提交于 2019-11-28 00:45:42
问题 I have the following example version: '2' services: proxy: container_name: proxy hostname: proxy image: nginx ports: - 80:80 - 443:443 volumes: - proxy_conf:/etc/nginx - proxy_htdocs:/usr/share/nginx/html volumes: proxy_conf: {} proxy_htdocs: {} which works fine. When I run docker-compose up it creates those named volumes in /var/lib/docker/volumes and all is good. However, from the host, I can only access /var/lib/docker as root, because it's root:root (makes sense). I was wondering if there

How to persist data in a dockerized postgres database using volumes

≡放荡痞女 提交于 2019-11-27 10:13:56
My docker compose file has three containers, web, nginx, and postgres. Postgres looks like this: postgres: container_name: postgres restart: always image: postgres:latest volumes: - ./database:/var/lib/postgresql ports: - "5432:5432 My goal is to mount a volume which corresponds to a local folder called ./database inside the postgres container as /var/lib/postgres . When I start these containers and insert data into postgres, I verify that /var/lib/postgres/data/base/ is full of the data I'm adding (in the postgres container), but in my local system, ./database only gets a data folder in it, i

Docker-compose named mounted volume

为君一笑 提交于 2019-11-27 05:18:23
问题 In order to keep track of the volumes used by docker-compose i like to use named volumes. This works great for 'normal' volumes like version: 2 services: example-app: volume: -named_vol:/dir/in/container/volume volumes: named_vol: But i cant figure out how to make it work when mounting the local host. I'm looking for something like: version: 2 services: example-app: volume: -named_homedir:/dir/in/container/volume volumes: named_homedir: /c/Users/ or version: 2 services: example-app: volume: -

ERROR: In file './docker-compose.yml', volume must be a mapping not a string

浪子不回头ぞ 提交于 2019-11-27 02:13:41
问题 Question: Why do I get this error? ERROR: In file './docker-compose.yml', volume 'mariavolume' must be a mapping not a string. My docker-compose file is almost identical to this one: https://docs.docker.com/compose/wordpress/ version: '2' services: wordpress: image: wordpress:latest restart: always depends_on: - db ports: - 8080:80 environment: WORDPRESS_DB_PASSWORD: example WORDPRESS_DB_HOST: 3306 db: image: mariadb restart: always environment: MYSQL_ROOT_PASSWORD: example volumes: - maria

How do I mount a host directory as a volume in docker compose

天大地大妈咪最大 提交于 2019-11-27 00:01:24
问题 I have a development environment I'm dockerizing and I would like the ability to livereload my changes without having to rebuild docker images. I'm using docker compose because redis is one of my app's dependencies and I like being able to link a redis container I have two containers defined in my docker-compose.yml : node: build: ./node links: - redis ports: - "8080" env_file: - node-app.env redis: image: redis ports: - "6379" I've gotten to the point in my node app's dockerfile where I add

How to persist data in a dockerized postgres database using volumes

狂风中的少年 提交于 2019-11-26 11:48:23
问题 My docker compose file has three containers, web, nginx, and postgres. Postgres looks like this: postgres: container_name: postgres restart: always image: postgres:latest volumes: - ./database:/var/lib/postgresql ports: - \"5432:5432 My goal is to mount a volume which corresponds to a local folder called ./database inside the postgres container as /var/lib/postgres . When I start these containers and insert data into postgres, I verify that /var/lib/postgres/data/base/ is full of the data I\