Given following docker-compose.yml setup:
version: '3.7'
services:
reverse:
container_name: nginx-reverse-proxy
hostname: nginx-reverse-proxy
image: nginx:stable
ports:
- 80:80
- 433:433
volumes:
- type: bind
source: ./config
target: /etc/nginx
consistency: consistent
this results in ./config
folder being mapped to the container nginx-reverse-proxy
and therefore in an empty /etc/nginx
directory inside the container.
Goal:
Mapping a folder from container to host. In my example from container /etc/nginx
to the host ./config
.
My current search constantly results in mapping a directoy from host to container (which i do not want).
Any hints/solutions are appreciated. Thanks!
My current solution is ugly:
I created the container with docker and copied the files from /etc/nginx
to ./config
. Removing the container and using the docker-compose up
works and nginx
starts because the needed files are already on the host.
Edit: The folder is not present at creation. Docker compose is creating the folder as stated in the docs.