docker安装

Posted zhanghaibin16

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker安装相关的知识,希望对你有一定的参考价值。

一、Docker介绍与安装

安装

官方安装文档

ubuntu下安装

如果是第一次安装,你需要先添加docker的源然后再安装

  1. 更新包

    sudo apt-get update

     

  2.  安装证书

    

sudo apt-get install     apt-transport-https     ca-certificates     curl     gnupg-agent     software-properties-common

  3. 添加docker的官方GPGkey  

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

  4. 添加docker源

sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/ubuntu    $(lsb_release -cs)    stable"

 

安装 docker ce

  1. 更新包索引

  sudo apt-get update

  2. 安装docker

  sudo apt-get install docker-ce

  3. 检测是否安装成功

  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/

 

 

为了方便使用,不用sudo就可以运行docker命令,安装好docker后再命令行输入如下命令:

sudo usermod -aG docker $USER

 

以上是关于docker安装的主要内容,如果未能解决你的问题,请参考以下文章

markdown docker-compose片段

sh Docker片段

Docker初级——介绍安装和使用

Docker和pip安装:避免在已安装某些软件包时安装所有软件包

在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途

PHP代码-psysh调试代码片段工具