K
K
KirillTrueno2022-04-16 22:45:38
Docker
KirillTrueno, 2022-04-16 22:45:38

How to mount an nginx image with python in docker?

What is the best way (less load on the server) to deploy a django project on a virtual server (VPS)?

Option 1: mount the nginx image and the python image via docker-compose in separate containers:

version: '3'

services:
  nginx:
    image: docker-nginx:latest
    build:
      dockerfile: deploy/nginx/Dockerfile
    ports:
      - 80:80

  app:
    image: docker-pytohn-app:latest
    build: 
      dockerfile: deploy/python/Dockerfile
    ports:
      - 8000:8000


Option 2: Mount the nginx image and the python image from the same Dockerfile in the same container:
FROM nginx:1.21-alpine
...

FROM python:3.9
...


Option 3: mount only the nginx image from one Dockerfile and install the python package into it:
FROM nginx:1.21-alpine
...
run apt install -y python3.9
...


And another question: what is the difference between installing python in the last two options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2022-04-16
@fox_12

In separate containers as the first option. Otherwise, what's the point of raising the docker at all ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question