(二)Docker安装(Ubuntu)

官方文档:https://docs.docker.com/

Docker 支持多平台的安装(Linux/Windows/OS X)。

因为Docker原生支持Linux,所以,可以直接在Linux上运行,而且在Windows和 OS X 平台则需要借助轻量级的 Linux VM 运行。

Ubuntu安装



在Ubuntu上安装Docker的说明取决于您使用的是Docker企业版(Docker EE)还是Docker社区版(Docker CE)。

参考文档:https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/

使用仓库进行安装

首次在新的主机上安装Docker CE之前,需要设置Docker仓库。 之后,你可以从存储库安装和更新Docker。

设置仓库

1、更新 apt 包索引:

$ sudo apt-get update

2、安装软件包,使它允许apt通过HTTPS使用仓库:

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

3、添加Docker的官方GPG密钥:

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

通过搜索密钥的最后8个字符,确认您现在已经拥有指纹 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 的密钥。

$ sudo apt-key fingerprint 0EBFCD88

pub   4096R/0EBFCD88 2017-02-22
      密钥指纹 = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <[email protected]>
sub   4096R/F273FCD8 2017-02-22

4、使用以下命令来设置 stable 的仓库。即使你想从 __edge __ 或 test 仓库安装构建,也总是需要 stable 的仓库。要添加 __edge __ 或 test 仓库,请在下面的命令中在单词stable之后添加edge或test(或两者)。

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

注意:上面的lsb_release -cs子命令返回你的Ubuntu发行版的名字,比如xenial。

安装Docker CE

1、更新 apt 包索引:

$ sudo apt-get update

2、安装最新版本有 Dcoker CE

$ sudo apt-get install docker-ce

3、在生产系统上,您应该安装特定版本的Docker CE,而不是始终使用最新版本。下面命令列出可用的版本。

$ apt-cache madison docker-ce

 docker-ce | 17.12.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.09.1~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.09.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.06.2~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.06.1~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.06.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.03.2~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

安装指定的版本:

$ sudo apt-get install docker-ce=<VERSION>

4、通过运行hello-world 镜像验证Docker CE是否正确安装。

$ sudo docker run hello-world

Unable to find image ‘hello-world:latest‘ locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:66ef312bbac49c39a89aa9bcc3cb4f3c9e7de3788c944158df3ee0176d32b751
Status: Downloaded newer image for hello-world:latest

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://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

其它

查看 Docker 版本:

$ sudo docker version

Client:
 Version:	17.12.0-ce
 API version:	1.35
 Go version:	go1.9.2
 Git commit:	c97c6d6
 Built:	Wed Dec 27 20:11:19 2017
 OS/Arch:	linux/amd64

Server:
 Engine:
  Version:	17.12.0-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.9.2
  Git commit:	c97c6d6
  Built:	Wed Dec 27 20:09:53 2017
  OS/Arch:	linux/amd64
  Experimental:	false

显示 Docker 系统信息,包括镜像和容器数:

$ sudo docker info

Containers: 7
 Running: 0
 Paused: 0
 Stopped: 7
Images: 2
Server Version: 17.12.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 20
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-26-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.924GiB
Name: ubuntu
ID: OXZY:HYGR:X6XJ:CLDF:H2UG:KXCY:J6MD:32WV:UORN:E2QY:TRTL:ISI6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

原文地址:https://www.cnblogs.com/jason89/p/9034107.html

时间: 2024-07-31 08:23:25

(二)Docker安装(Ubuntu)的相关文章

docker 二.docker 安装

Docker 安装 一.Docker安装 1.1.1 docker 安装在RHEL/centos上 **推荐是rhel/centos 系统的版本必须大于 6.5 以上 6系列最好是6.6 运行docker较稳定,低于6.5以下安装docker 第一要升级内核 docker运行不稳定,7系列已经把docker的包放在自己的库 对于 CentOS6,可以使用epel库安装 Docker,命令如下 rpm -ivh http://mirrors.yun-idc.com/epel/6/i386/epel

Docker(二)-Docker安装

官方文档:https://docs.docker.com/ Docker 支持多平台的安装(Linux/Windows/OS X). 因为Docker原生支持Linux,所以,可以直接在Linux上运行,而且在Windows和 OS X 平台则需要借助轻量级的 Linux VM 运行. Ubuntu在线安装docker 在Ubuntu上安装Docker的说明取决于您使用的是Docker企业版(Docker EE)还是Docker社区版(Docker CE). 参考文档:https://docs.

jenkins 实验 (二) docker安装jenkins

先安装docker yum install dock* -y systemctl start docker.service 启动docker失败鸟,容我修个错误 看下服务啥错误 systemctl status docker.service -l 坑 Error starting daemon: SELinux is not supported with the ov 重新编辑docker配置文件: vi /etc/sysconfig/docker 在docker里禁用selinux,--sel

002.Docker安装部署

一 docker安装-CentOS系统 1.1 docker自动安装脚本 1 [email protected]:~# wget -qO- https://get.docker.com/ | sh 2 或-- 3 [email protected]:~# curl -sSL https://get.docker.com/ | sh 注意:若出现以下错误,可使用yum解决依赖-- Delta RPMs disabled because /usr/bin/yum provides applydelt

安装Ubuntu双系统系列——安装Ubuntu

一.将Ubuntu系统烧进U盘 1.打开老毛桃,选择“U盘启动” -> "ISO模式":选择ISO文件,我这里安装的是Ubuntu12.04-64bit,你可以在网上下载一个. ubuntu-12.04.4-desktop-amd64.iso: http://pan.baidu.com/s/1gepFhb9 ubuntu-12.04.3-desktop-i386.iso: http://pan.baidu.com/s/1ntPe4dF 记得事先要把u盘插进电脑,把里面的文件格式化

使用workstation安装Ubuntu

用到软件:1.VMware-workstation-full-15.0.4用到镜像:1.ubuntu-18.04.2-live-server-amd64.iso 一.在workstation上安装Ubuntu系统1.新建虚拟机2.自定义安装3.下一步4.稍后安装操作系统5.系统版本选择Ubuntu6.虚拟机名称7.设置CPU数量,建议使用8个及以上CPU:8.内存8G9.网络选择nat10.默认11.默认12.默认13.硬盘配置200G14.默认15.完成16.设置CPU开启虚拟化功能17.选择

ubuntu下docker安装与版本升级

ubuntu 下docker安装与版本升级 一.系统环境 系统:ubuntu-server 14.04 x86_64 内核:3.13.0-32-generic 二.Docker安装 --------------------------------------------------------------------------------- 要想安装最新版本的Docker需要使用Docker源来安装 $ sudo su - root # apt-get -y installapt-transp

Ubuntu 16.04 docker安装

一.准备 Docker需要64位的操作系统 Linux kernel 版本不得低于3.10 1. 更新源 $ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates 2. 添加GPG key $ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070AD

Ubuntu下用docker安装redis镜像和使用redis容器分享

Ubuntu下用docker安装redis镜像和使用redis容器分享 1. 安装Ubuntu 2. 用Putty登录Ubuntu Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-40-generic x86_64) * Documentation:  https://help.ubuntu.com/ System information as of Wed Dec 31 06:41:16 UTC 2014 System load:  0.01  

linux安装(Ubuntu)——(二)

centos的安装参考: http://www.runoob.com/linux/linux-install.html Linux 安装(Ubuntu) 虚拟机:虚拟机(Virtual Machine),在计算机科学中的体系结构里,是指一种特殊的软件,他可以在计算机平台和终端用户之间建立一种环境,而终端用户则是基于这个软件所建立的环境来操作软件.在计算机科学中,虚拟机是指可以像真实机器一样运行程序的计算机的软件实现. 一.    安装Vmware 虚拟机 第一步:执行VMware-worksta