# Check the system version
lsb_release -a
Output:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
# install docker
sudo snap install docker
sudo apt install docker-compose
# check version
docker --version
docker-compose --version
Docker image construction and enabling method 1
# Build the image and execute it in the directory where the Dockerfile file is located
docker build -t chatgpt:v3.5 .
# Create a new container and run a command
docker run --name=chatgpt --volume=/home/ubuntu/chatgpt-demo/.env:/usr/src/.env:rw -p 3000:3000 --restart=always -d chatgpt:v3.5
# show all containers
docker ps -a
# Delete container rm [CONTAINER ID]
docker rm 1fafd93d9497
# delete mirror
docker rmi chatgpt-demo
Docker image construction and enabling method 2
# create
docker-compose build
# start up
docker-compose up -d
# stop
docker-compose down