From Fedora Project Wiki

Hub page for Docker-on-Fedora links and overview.

Installing Docker

Installing Docker on Fedora 19

Remove the docker package. It conflicts with the docker-io package ( read all about this matter in BZ#1043676).

   $ sudo yum -y remove docker

Install the docker-io package.

   $ sudo yum install -y docker-io

Start the Docker daemon.

   $ sudo systemctl start docker

Note To make Docker start at boot, run sudo systemctl enable docker.

Verify that Docker is working:

   $  sudo docker run -i -t fedora /bin/bash

The following happens if there is no local fedora image:

 [user@localhost docker]$ sudo docker run -i -t fedora /bin/bash
   					Unable to find image 'fedora' locally
   					Pulling repository fedora
   					b7de3133ff98: Download complete 
   					5cc9e91966f7: Download complete 
   					511136ea3c5a: Download complete 
   					ef52fb1fe610: Download complete 
   					bash-4.2#

Testing your Docker setup

⁠Test your Docker setup with the fedora' image:

  $ sudo docker pull fedora 

Run the following command to run "Hello World" by means of Busybox:

  $ sudo docker run fedora /bin/echo hello world

The following text appears:

 hello world

Installing Docker on Fedora 20

Remove the docker package:

 $ sudo yum -y remove docker

Install the wmdocker package:

 $ sudo yum -y install wmdocker

Install docker-io:

 $ sudo yum -y install docker-io

Update the docker-io package:

 $ sudo yum -y update docker-io

Docker Commands

docker info

This command displays system-wide information about docker.

 $ sudo docker info
 [sudo] password for zdover1: 
 Containers: 43
 Images: 124
 Storage Driver: devicemapper
  Pool Name: docker-253:2-1977550-pool
  Pool Blocksize: 64 Kb
  Data file: /var/lib/docker/devicemapper/devicemapper/data
  Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
  Data Space Used: 14416.3 Mb
  Data Space Total: 102400.0 Mb
  Metadata Space Used: 15.3 Mb
  Metadata Space Total: 2048.0 Mb
 Execution Driver: native-0.2
 Kernel Version: 3.16.3-200.fc20.x86_64
 Operating System: Fedora 20 (Heisenbug)
 Username: username
 Registry: [1]

docker run

This command runs a docker container.

 $ sudo docker run busybox /bin/echo this is an echo

The above command runs busybox, calls /bin/echo, and passes the string "this is an echo" to busybox.

 $ sudo docker run a87ecb4f327c -i -t /bin/bash

The above command runs image a87ecb4f327c interactively (-i) with a pseudo-teletype interface (-t), and delivers you into a BASH shell.

Mapping container ports to host ports

 $ docker run -p 8080:80 -d -i -t fedora/httpd

The above command runs fedora/httpd in a container in detached mode, interactively, with a pseudo-teletype. Container port 80 is mapped to host port 8080 by means of the part of the command reading -p 8080:80.

docker ps

This command shows containers. By default, the command shows only running containers.

 $ sudo docker ps

To show all containers (including containers that are not running), use this command:

 $ sudo docker ps -a

Dockerfiles

Upstream for Fedora Dockerfiles is available at: https://github.com/fedora-cloud/Fedora-Dockerfiles

These Dockerfiles are also available as a package fedora-dockerfiles:

   #> yum install fedora-dockerfiles
   #> ls /usr/share/fedora-dockerfiles