Користувальницькькі налаштування

Налаштування сайту


software:docker:tips

Це стара версія документу!


Short docker info

docker container ls --filter "status=running" --format 'table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}'

Show path to container log

docker inspect container_name|grep LogPath

Security: pull images

Once a week stop using caching and update all layers (–pull –no-cache):

docker build --pull --no-cache -t image-tag .

Python multistage builds

Dockerfile.multi
ARG MY_PYTHON_VER=3.8.10
# base
FROM python:${MY_PYTHON_VER}-buster as base
COPY ./requirements.txt /
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /wheels -r requirements.txt

# stage
FROM python:${MY_PYTHON_VER}-slim-buster
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
    DEBIAN_FRONTEND=noninteractive apt-get -y install jq && \
    apt-get clean
WORKDIR /usr/src/app
COPY --from=base /wheels /wheels
COPY --from=base requirements.txt .
RUN pip install --no-cache /wheels/*
COPY . /usr/src/app
CMD gunicorn -b 0.0.0.0:5000 manage:app
software/docker/tips.1620897554.txt.gz · Востаннє змінено: 2021/05/13 12:19 повз charon