安装docker以及问题解决办法

1.使用官方推荐的方式安装 yum-utils
yum install -y yum-utils
2.使用如下的命令设置稳定版的 repository
yum-config-manager \
          --add-repo \
          https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo

出现错误Loaded plugins: fastestmirror, refresh-packagekit

更改文件:
    1.vim  /etc/yum/pluginconf.d/fastestmirror.conf
        enabled=0
    2. vim /etc/yum.conf
        plugins=0

更新yum
    yum makecache fast

3.创建文件
    vim /etc/yum.repos.d/docker.repo
输入以下内容
    [dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg




4.安装最新版本的docker

yum -y install docker-engine



5.启动docker
    service docker start


6.使用docker
    docker  run hello-world

可以使用service docker status查看状态
发现错误
Cannot connect to the Docker daemon at 。。。

查看进程出现

docker dead but pid file exists


删除/var/run 下面的docker.xx文件均没用

使用以下方法:
yum-config-manager --enable public_ol6_latest
yum install device-mapper-event-libs
参考 http://stackoverflow.com/questions/27216473/docker-1-3-fails-to-start-on-rhel6-5

正常启动显示docker (pid  2295) is running...

测试docker

[root@localhost run]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from hello-world
65b27d3bd74d: Pull complete
9f5834b25059: Pull complete
Digest: sha256:fb158b7ad66f4d58aa66c4455858230cd2eab4cdf29b13e5c3628a6bfc2e9f05
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://hub.docker.com/

For more examples and ideas, visit:

完成

猜你喜欢

转载自www.cnblogs.com/sunshine99/p/10763072.html
今日推荐