目录
1.上传工程及镜像
root@iZ8vbdn64nyz3h1qvey2rbZ:~# ls /
bin boot dev etc home lib lib32 lib64 libx32 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var
# 1.新建一个project的一级目录
root@iZ8vbdn64nyz3h1qvey2rbZ:~# mkdir /project
# 2. 安装传输工具
#Ubuntu:apt intall lrzsz -y
# 3.上传工程文件压缩包
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# rz #或者直接拖拽文件上传
# 4.查看文件
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# ls
u204.zip
# 5.安装解压工具,针对zip:unzip
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# sudo apt install unzip
# 6.把u204.zip压缩包解压到当前文件夹
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# unzip u204.zip
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# ls
build.sh Dockerfile server u204.zip
2.安装docker
# 1.安装docker(Ubuntu)
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# cd ~
root@iZ8vbdn64nyz3h1qvey2rbZ:~# apt update
root@iZ8vbdn64nyz3h1qvey2rbZ:~# apt install docker.io #执行此命令需要使用sudo或以root身份运行,即进入~
# 2.查看docker版本,验证是否安装成功
root@iZ8vbdn64nyz3h1qvey2rbZ:~# docker version /或者 docker info
root@iZ8vbdn64nyz3h1qvey2rbZ:~# docker ps
3.生成镜像(images)
# 1.执行运行脚本(运行Dockerfile)
root@iZ8vbdn64nyz3h1qvey2rbZ:/# cd /project
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# chmod +x build.sh
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# ./build.sh
# 2.查看docker镜像
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
pymy latest b8fdd4955e69 14 hours ago 1.36GB
python 3.10 748d669298ac 6 weeks ago 1e+03MB
4.生成容器(container)并运行
# 1.映射端口8082:8000
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# docker run -d -ti -p 8082:8000 pymy
c40da004003bc57a4d11d7ba6d89f5fba4fd089367e7d743a0f848490f558753
# 2.查看系统容器(container),即进程
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c40da004003b pymy "python3 manage.py r…" 55 seconds ago Up 53 seconds 0.0.0.0:8082->8000/tcp, :::8082->8000/tcp pedantic_chebyshev
adbb1045da29 pysrv "python3 manage.py r…" 14 hours ago Up 14 hours 0.0.0.0:8080->8000/tcp, :::8080->8000/tcp brave_davinci
# 3.运行端口
root@iZ8vbdn64nyz3h1qvey2rbZ:/project# curl 127.0.0.1:8082
5.开放端口
6.测试端口:
标签:8082,部署,8000,系统,project,iZ8vbdn64nyz3h1qvey2rbZ,docker,root From: https://www.cnblogs.com/DQ-MINE/p/17892185.html端口:47.92.84.209:8082