docker 笔记

原创
10/18 23:56
阅读数 11

安装

  • 跟新软件包
apt-get update
  • 安装所所需软件依赖
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
  • 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  • 添加docker源
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  • 安装docker
apt-get update && apt-get install -y docker-ce

配置

  • 根据阿里云容器镜像服务中得镜像加速器配置自己得docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://XXXXXXXXXX.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
  • 查看docker版本
docker version
  • 查看docker信息
docker info
  • 拉取tomcat
root@iZm5e1mit4wjkdmdvk2pn6Z:/etc/docker# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
e4c3d3e4f7b0: Pull complete 
101c41d0463b: Pull complete 
8275efcd805f: Pull complete 
751620502a7a: Pull complete 
a59da3a7d0e7: Pull complete 
9c0f1dffe039: Pull complete 
c886bd27ecb8: Pull complete 
30fb11aa7eaa: Pull complete 
c9f12e463311: Pull complete 
421d9a80377a: Pull complete 
Digest: sha256:1c78db4bfbf4c75ab763dd463ff74731abbeadcfded2e03024b39cb0af3f1fb3
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
  • 查看已经拉取得镜像
root@iZm5e1mit4wjkdmdvk2pn6Z:/etc/docker# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tomcat              latest              891fcd9c5b3a        4 days ago          647MB

展开阅读全文
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部