2022-10-25 16:12:59
浏览数 (1)
一、基本命令
代码语言:javascript
复制# build
docker build -f ${Dockderfile_path} .
# tag
docker tag ${image_id} ${REPOSITORY}:${TAG}
# run
# -d 运行在后台;-i 打开STDIN控制台交互;-t 分配tty设备支持终端登录
# --privileged=true:容器内的root拥有真正root权限,否则容器内root只是外部普通用户权限
#
docker run ${option} ${REPOSITORY}:${TAG}
# 例子
docker run --name ${container_name} -p 8000:8000 --privileged=true -v /root/config:/app/config -v /root/logs:/app/logs ${REPOSITORY}:${TAG}
# commit
docker commit ${option} ${container_id/name}/${REPOSITORY}:${TAG}
# stop start restart
docker start/restart/stop ${container_id/name}
# save
docker save ${container_id/name} > ${file_path}/${tar_file_name}
# load
docker load > ${file_path}/${tar_file_name}
# push
docker push ${注册名/地址}/${REPOSITORY}:${TAG}
# pull
docker pull ${REPOSITORY}:${TAG}
# 查看容器运行配置
docker inspect ${container_id/name}
二、腾讯云镜像仓库实践
代码语言:javascript
复制# 登录
sudo docker login --username=${TencentClooud_APP_ID} ${remote_repository}
# 拉取镜像
sudo docker pull ${remote_repository}:${tag}
# 推送镜像
sudo docker tag ${Image_Id} ${remote_repository}:${tag}
sudo docker push ${remote_repository}:${tag}