description |
---|
Django app docker creation |
$ django-admin startproject DockerTestDjango
$ cd DockerTestDjango/
FROM python:3.8-slim-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /app
WORKDIR /app
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY . /app/
EXPOSE 5002
version: '3'
services:
web:
image: abhijith/opencv
build: .
command: python3 manage.py runserver 0.0.0.0:5002
volumes:
- .:/app
ports:
- "5002:5002"
$ sudo docker-compose up -d
sudo docker container prune
docker rmi <your-image-id>
# delete all unused images
sudo docker image prune
sudo systemctl stop docker
# restart
sudo systemctl start docker
add the following line in Docker file
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
complete code
FROM python:3.8-slim-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /app
WORKDIR /app
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
COPY requirements.txt /app/
RUN pip3 install -r requirements.txt
COPY . /app/
EXPOSE 5002
or add
opencv-python-headless
in requirements.txt file
docker commit container-id image-name
docker save image-name > image-name.tar
cat image-name.tar | docker load