Answer the question
In order to leave comments, you need to log in
How to connect a new container with existing ones in docker?
I have 3 containers running
abc4a396878a dpage/pgadmin4 "/entrypoint.sh" 4 weeks ago Up 41 hours 443/tcp, 0.0.0.0:5555->80/tcp pgAdmin_cont
9063ca5b49af app_app "python main.py" 4 weeks ago Up 41 hours 0.0.0.0:5050->5050/tcp app_flask_api
476cc4dffe86 postgres:13 "docker-entrypoint.s…" 4 weeks ago Up 41 hours 0.0.0.0:6532->5432/tcp postgres_cont
FROM python:3.8
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# set work directory
RUN mkdir /app
WORKDIR /app
COPY . /app
ENV FASTAPI_ENV = "app"
# install dependencies
RUN pip install --upgrade pip
RUN pip install -r req.txt
RUN pip install -r req.txt
VOLUME .:/app
EXPOSE 8000
CMD ["python", "main.py"]
# порт и пр прописаны в конфигах main.py
version: '3.8'
services:
app_fastapi:
container_name: "app_fastapi"
build:
context: ./
dockerfile: Dockerfile
volumes:
- .:/app
ports:
- 8000:8000
entrypoint: ["python", "main.py"]
restart: unless-stopped
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question