D
D
daniil_krsk2020-12-17 08:48:40
Docker
daniil_krsk, 2020-12-17 08:48:40

Docker + nginx + php-fpm bundle how to share folders between containers?

Good afternoon.

Question: how can I share folders between containers, taking into account the fact that periodic updates will be needed?

There is a php application, it contains a web interface, a separate worker (runs through cli). The decision was made to separate this application and move it to docker.
Created:
1. docker container with php_fpm environment + source + static files
2. docker-compose.yml: (common features)

services:
  nginx:
    volumes:
      source:/var/www
  php:
    image: php_app
    volumes:
        source:/var/www
 worker:
     image: php_app
  volumes:
     source: 
        external: true


In this configuration, a named volume is used; according to the documentation, it is not updated with the next docker stack deploy. you have to clean up this volume or delete it.
The mount bind option is also not ideal, because. you will have to copy the data from the container to the host machine.

What methods to link folders between nginx and php services?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
daniil_krsk, 2020-12-17
@daniil_krsk

I had to apply
a very ugly solution: gitlab-cicd added copying to that
$ docker cp $(docker ps -f name=php-q): /var/www /pathto/docker/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question