docker配置认证linux,LinuxMint下Docker的安装部署和验证

通过lsb_release命令查看以下我的LinuxMint发行版,

23b1f8af70878277c55e30fbb2709c9c.png

查看以下我的Linux内核版本,

d21a5118f4ad00971f4964f5165704ef.png

Docker要求Linux内核版本必须在要在3.10以上,显然我们的系统是满足的。

1. Docker安装

操作系统默认的apt源有docker包,我们可以直接使用下面的apt-get命令安装docker,

$ sudo apt-get install -y docker.io

不过其安装的版本比较老。我们采用下面两种方式进行安装,个人比较推荐第二种,第二种方式安装的是最新的。

1.1 从Docker的apt源安装

参考网页https://get.docker.com/Ubuntu/内容进行安装,为方便直接将内容复制如下,

# Check that HTTPS transport is available to APT

if [ ! -e /usr/lib/apt/methods/https ]; then

apt-get update

apt-get install -y apt-transport-https

fi

# Add the repository to your APT sources

echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list

# Then import the repository key

apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

# Install docker

apt-get update

apt-get install -y lxc-docker

目前从Docker的apt源安装的docker版本是1.7.1。

1.2 curl安装

网站https://get.docker.com提供了curl-able的安装脚本install.sh,我们可以通过curl的方式进行安装docker。我们先安装curl,

$ sudo apt-get update

$sudo apt-get install curl

然后运行下面命令安装docker,

$ curl -k -sSl https://get.docker.com | sudo sh

该方式安装的docker版本是1.8.3,如下所示,

55638a957c8c86248d6630a11096b042.png

2. Docker验证

Docker安装结束后,我们来验证以下docker的功能。官方的Docker Hub提供了hello-world的镜像,我们可以通过该镜像起一个容器来验证我们已正确安装了docker。

lienhua34@lienhua34-Compaq-Presario-CQ35-Notebook-PC ~ $ 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.3. The Docker daemon created a new container from that image whichruns the

executable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, whichsent it

to your terminal.

To try somethingmoreambitious, you can run an Ubuntu container with:

$ docker run-it ubuntu bash

Share images, automate workflows, andmore with a freeDocker Hub account:

https://hub.docker.com

Formoreexamples and ideas, visit:

https://docs.docker.com/userguide/

出现上面打印信息表示,docker已正常工作。

3. 后记

有了docker之后,我们如果验证某些linux下的功能,而有不希望污染到我们的主机环境。那么我们就可以起一个linux环境的容器,然后在里面进行操作。操作结束后,就直接将容器杀掉即可。安全、方便、快捷!

例如下面启动一个Ubuntu 14.04的容器,并直接进入该容器,然后我们就可以在该容器里随便进行操作了。

$ sudo docker run -ti --name myubuntu ubuntu:14.04

c5e25c16b1d7bb94e4ff7ff57a71e6df.png

(done)

更多Docker相关教程见以下内容:

Docker 的详细介绍:请点这里

Docker 的下载地址:请点这里

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值