I have a directory in the host and I want to mount it to a container and to Nginx public folder which is a container itself.
Here is my docker-compose.yml file :
version: "3.3"
services:
nodeserver:
build:
context: ./app
volumes:
- /client-images:/usr/src/app/client-images
ports:
- "9000:9000"
nginx:
restart: always
build:
context: ./nginx
ports:
- "80:6000"
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: my_secret_mysql_password
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- "8080:80"
environment:
- PMA_ARBITRARY=1
volumes:
images:
My images are located in the /client-images directory but how can I mount them to Nginx public directory and access them?
3
Answers
you should bind to
/usr/share/nginx/html
your files. It is default location. If you want to change default location, you should change/etc/nginx/conf.d/default
.I prefer use templates via nginx:1.19-alpine.
templates docs