lnlidawei

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

【docker_ubuntu2604】:docker安装和配置

【docker_ubuntu2604】:docker安装和配置

 

 

 

 

一、基本说明

 

  1、  docker,从国外获取资源时,网速较慢。因此,需要使用国内的镜像网站,来提升获取资源的速度。

 

 

 

二、docker安装和配置

 

  1、  docker安装

#  ubuntu2604,有效
# 下载并执行Docker官方安装脚本

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh


# 启动服务docker;开机自动启动服务docker
sudo systemctl start docker
sudo systemctl enable docker

 

  2、  配置国内加速网站docker(  /etc/docker/daemon.json  )

 

{
        "registry-mirrors":
        [       "https://docker.1ms.run",
                "https://docker.mirrors.tuna.tsinghua.edu.cn",
                "https://m.daocloud.io",
                "https://docker.xuanyuan.me",
                "https://reg-mirror.qiniu.com", 
                "https://docker.mirrors.ustc.edu.cn",
                "https://hub-mirror.c.163.com"
        ]
}

 

[wit@ubuntu:docker]$ pwd
/etc/docker
[wit@ubuntu:docker]$ 
[wit@ubuntu:docker]$ ls
daemon.json
[wit@ubuntu:docker]$ 
[wit@ubuntu:docker]$ sudo cat  daemon.json 
{
        "registry-mirrors":
        [       "https://docker.1ms.run",
                "https://docker.mirrors.tuna.tsinghua.edu.cn",
                "https://m.daocloud.io",
                "https://docker.xuanyuan.me",
                "https://reg-mirror.qiniu.com", 
                "https://docker.mirrors.ustc.edu.cn",
                "https://hub-mirror.c.163.com"
        ]
}
[wit@ubuntu:docker]$ 
[wit@ubuntu:docker]$ 
[wit@ubuntu:docker]$ sudo systemctl daemon-reload 
[wit@ubuntu:docker]$ 
[wit@ubuntu:docker]$ sudo systemctl restart  docker
[wit@ubuntu:docker]$ 

 

  3、  检验docker是否安装成功:

[wit@ubuntu:docker]$ sudo docker run  hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 

 

 

三、参考资料:

 

  1、  docker 安装  --  https://www.runoob.com/docker/ubuntu-docker-install.html

 

  2、  docker 教程  --  https://www.runoob.com/docker/docker-tutorial.html

 

  3、  docker 相关网站资源  --  https://www.runoob.com/docker/docker-resources.html

 

  4、  docker 官网  --  https://www.docker.com/

 

  5、  docker 官方文档  --  https://docs.docker.com/

 

.

posted on 2026-04-09 14:57  lnlidawei  阅读(3)  评论(0)    收藏  举报