Troubleshooting Docker
上QQ阅读APP看书,第一时间看更新

Installing Docker on Fedora

Docker is supported on Fedora version 22 and 23. The following are the steps to be performed in order to install Docker on Fedora 23. It can be deployed on bare-metal or as a VM.

Checking Linux kernel Version

Docker requires 64-bit installation, regardless of the Fedora version. Also, the kernel version should be at least 3.10. Check the kernel version before going ahead with installation using the following command:

$ uname -r
4.4.7-300.fc23.x86_64
Switch to root user
[os@osboxes ~]# su -
Password:
[root@vkohli ~]#

Installing with DNF

Update the existing DNF package by using the following command:

$ sudo dnf update 

Adding to the YUM repository

Let's add the Docker repository to the YUM repository:

$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' > [dockerrepo] > name=Docker Repository > baseurl=https://yum.dockerproject.org/repo/main/fedora/$releasever/ > enabled=1 > gpgcheck=1 > gpgkey=https://yum.dockerproject.org/gpg > EOF [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/fedora/$releasever/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg

Installing the Docker package

The Docker Engine can be installed using the DNF package:

$ sudo dnf install docker-engine

The output will be similar to the following listing (this listing is truncated):

Docker Repository 32 kB/s | 7.8 kB 00:00 Last metadata expiration check: 0:00:01 ago on Thu Apr 21 15:45:25 2016. Dependencies resolved. Install 7 Packages ... Running transaction test Transaction test succeeded. Running transaction Installing: python-IPy-0.81-13.fc23.noarch .... Installed: ... Complete!

Start the Docker service using systemctl:

$ sudo systemctl start docker 

Verify with a Docker hello-world example in order to check whether Docker is installed successfully:

[root@osboxes ~]# docker run hello-world 

The output will be similar to the following listing:

Unable to find image 'hello-world:last' locally latest: Pulling from library/hello-world 03f4658f8b78: Pull complete a3ed95caeb02: Pull complete Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 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.
  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 the following command:

$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account, https://hub.docker.com.

For more examples and ideas, visit https://docs.docker.com/userguide/md64-server-20160114.5 (ami-a21529cc).