Docker hello-world

安装方式(一)

直接通过install lxc-docker的方式安装
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

#
# Alternatively, just use the curl-able install.sh script provided at https://get.docker.com
#

使用这种的安装方式,可以参考
ubuntu安装Docker

安装方式(二)

通过curl的方式安装
官方文档推荐的安装方式

  • 确认是否安装curl,否就安装
$ which curl
$ sudo apt-get install curl
  • 添加Docker仓库的GPG秘钥
$ curl -sSL https://get.docker.com/gpg | sudo apt-key add -
  • 安装Docker
$ curl -sSL https://get.docker.com/ | sh

运行Docker

docker进程是一个守护进程,可以通过两种方式docker进程拉起来

  • 1.使用常见拉起服务的方式
$ sudo service docker start
  • 2.使用加命令行参数的方式( 不推荐)
$ sudo docker -d

遇到的问题

  • 必须先起docker进程,否则报错如下
fage@iZ94s1sibj6Z:~$ sudo docker info
Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
  • 阿里云运行docker问题
    阿里云把所有内网IP都占用了把所有内网IP都占用了,导致docker进程不能拉起,报错信息如下
fage@iZ94s1sibj6Z:~$ sudo docker -d
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
INFO[0000] [graphdriver] using prior storage driver "aufs" 
WARN[0000] Running modprobe bridge nf_nat failed with message: , error: exit status 1 
FATA[0000] Error starting daemon: Error initializing network controller: Error creating default "bridge" network: can't find an address range for interface "docker0"

你可能感兴趣的:(Docker hello-world)