H
H
hesy2019-02-10 17:13:06
Docker
hesy, 2019-02-10 17:13:06

Container with LNP, how to mount folders?

It is necessary to have nginx and php in one container.
It was decided to install php and nginx on the Ubuntu image and run from there, but how to mount the folder with the project / logs and how to open the site in the browser if it is running inside the container?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-02-10
@Casufi

1) It's a bad idea to keep both nginx and php in the same container, it's much better to run two containers together, one with nginx, the second with php
2) You can copy project files with the COPY command in the dockerfile
here is an example for python

FROM python:2.7
LABEL maintainer="Kotulskyi Volodymyr"
WORKDIR /var/opt
COPY ./app ./
RUN pip install -r requirements.txt
CMD python app.py

In order to forward the port of the container to the outside, there is an option -p
docker run \
  -d -ti \
  -p 5000:80 \
  --name course-app \

https://docs.docker.com/engine/reference/run/
Here is an example using docker compose, but I haven't tried
it geekyplatypus.com/dockerise-your-php-application-w... You
can also go https ://www.udemy.com/docker-and-kubernetes-the-co...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question