Jan 30, 2021
0
Level 14
What is the proper way to persist storage on production using Docker?
I have 2 Docker containers - 1) for Nginx and 2) for PHP server. When I upload a file using Laravel, the file is not on the PHP server container but not on Nginx container.
So far, I was able to solve this problem by creating a volume and sharing that volume for both containers. But is this the best way to do it? Does it have any performance downsides?
P.S. I don't want to use something like S3 for storage right now.
Here are my containers:
# Nginx server for the server side app
app-nginx-server:
container_name: app-nginx-server
build:
dockerfile: ./docker/nginx-server/Dockerfile-production
volumes:
- ./server/storage:/var/www/storage
ports:
- 41166:80
networks:
- app-network
# PHP server for the server side app
app-php-server:
build:
dockerfile: ./docker/php-server/Dockerfile-production
container_name: app-php-server
restart: always
volumes:
- ./server/storage:/var/www/storage
networks:
- app-network
Please or to participate in this conversation.