搭建自己的docker镜像

1.关键字查找镜像

sudo docker search centos

2.下载基本镜像

sudo docker pull centos

3.启动容器

sudo docker run -d -it --name centos1 -h centos1 -p 91:80 -v /home/root:/my_python -w my_python centos /bin/bash
# 查看已经启动的docker
docker container ls

4.进入容器

sudo docker exec -it 容器id /bin/bash

5.进入更新软件

apt-get update

6.安装软件

yum install -y gcc   等

7.退出

exit

8.停止容器

docker stop 容器id

9.提交镜像

sudo docker commit -m "python3" 73795020d9d8 ubuntu-python3:3.5
73795020d9d8 容器id
ubuntu-python3 名字
3.5 :版本号

  

猜你喜欢

转载自www.cnblogs.com/yoyo1216/p/10879919.html
今日推荐