The best practice of using Docker on development and production.

In the development environment,use DockerCompose.

In normal development environments, file changes need to be reflected in real time. Therefore, the document root in Docker is mounted on a local directory with DockerCompose.

Dockerfile

...
# Set correct environment variables.
RUN mkdir -p /var/www/docker
WORKDIR /var/www/docker
# Set up application
COPY . .
...

DockerCompose

version: "3"
...
web:
build:
context: .
dockerfile: Dockerfile
volumes: - ./:/var/www/docker
working_dir: /var/www/docker
...

In the production environment,use only Docker, not use DockerCompose.

コメントを残す

メールアドレスが公開されることはありません。