From Fedora Project Wiki

Line 87: Line 87:
   Username: username
   Username: username
   Registry: [https://index.docker.io/v1/]
   Registry: [https://index.docker.io/v1/]
==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 container a87ecb4f327c interactively (-i) with a pseudo-teletype interface (-t), and delivers you into a BASH shell.
==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

Revision as of 21:06, 7 October 2014

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#

⁠Test your Docker setup with the busybox container:

  $ sudo docker pull busybox

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

  $ sudo docker run busybox /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 container a87ecb4f327c interactively (-i) with a pseudo-teletype interface (-t), and delivers you into a BASH shell.

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