Hub page for Docker-on-Fedora links.
Docker implements a lightweight virtualization technique allowing to isolate applications including complex dependencies (such as a minimal subset of a particular Linux distribution) in a portable container.
Install the docker package.
$ sudo dnf install docker
Start the Docker daemon.
$ sudo systemctl start docker
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 available:
Unable to find image 'fedora:latest' locally latest: Pulling from docker.io/fedora 48ecf305d2cf: Pull complete ded7cd95e059: Already exists docker.io/fedora:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. Digest: sha256:10ba981a70632d7764c21deae25c6521db6d39730e1dd8caff90719013858a7b Status: Downloaded newer image for docker.io/fedora:latest [root@e6b4bcda8a48 /]#
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
This command displays system-wide information about docker.
$ sudo docker info Containers: 2 Images: 2 Storage Driver: devicemapper Pool Name: docker-253:2-2242558-pool Pool Blocksize: 65.54 kB Backing Filesystem: extfs Data file: /dev/loop0 Metadata file: /dev/loop1 Data Space Used: 525.7 MB Data Space Total: 107.4 GB Data Space Available: 43.42 GB Metadata Space Used: 978.9 kB Metadata Space Total: 2.147 GB Metadata Space Available: 2.147 GB Udev Sync Supported: true Deferred Removal Enabled: false Data loop file: /var/lib/docker/devicemapper/devicemapper/data Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata Library Version: 1.02.93 (2015-01-30) Execution Driver: native-0.2 Logging Driver: json-file Kernel Version: 4.0.8-300.fc22.x86_64 Operating System: Fedora 22 (Twenty Two) CPUs: 4 Total Memory: 7.716 GiB Name: laptop019.n2317.net ID: Z3JN:VBYN:K3ES:W3J2:JU2J:Y24L:XXXB:N5FD:RFOW:SJMC:RTOQ:CETO
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 -i -t a87ecb4f327c /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.
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
Upstream for Fedora Dockerfiles is available at: https://github.com/fedora-cloud/Fedora-Dockerfiles
$ sudo dnf -y install fedora-dockerfiles $ ls /usr/share/fedora-dockerfiles
This will give you an overview:
ansible busybox dhcpd firefox haskell libvirt memcached mysql owncloud qpid registry ssh apache couchdb Django flask jenkins lighttpd mesos nginx postgres rabbitmq ruby systemd bind cups earthquake hadoop lapis mariadb mongodb nodejs python redis squid wordpress