How To Install Docker on Fedora 23
Docker is a container-based software framework commonly used for automating deployment of applications. Containers are encapsulated, lightweight, and portable application modules.
Pre-Flight Check
- These instructions are intended for installing Docker on Fedora 23. If you’re using an older version of Fedora or a different operating system, check our tutorials for Fedora 21 and Ubuntu 15.04.
- We’ll be logging into a Liquid Web Self Managed Fedora 23 server as root.
Step #1: Install Docker on Fedora 23
As a matter of best practice, we’ll update our packages:
dnf update -y
We’ll install Docker by installing the docker-io package:
dnf -y install docker-io
Once the installation completes, we’ll need to start the Docker daemon:
systemctl start docker
Now we’ll configure Docker to start when the server boots:
systemctl enable docker
That should produce output similar to the following:
[root@host ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
Step #2: Download a Docker Container
To get started using Docker, we’ll download the Fedora Docker image:
docker pull fedora
That should produce output similar to the following:
[root@host ~]# docker pull fedora
Using default tag: latest
Trying to pull repository docker.io/library/fedora ... latest: Pulling from library/fedora
369aca82a5c0: Pull complete
3fc68076e184: Pull complete
Digest: sha256:7d916d5d3ab2d92147e515d3c09cb47a0431e2fff9d550fd9bcc4fed379af9ea
Status: Downloaded newer image for docker.io/fedora:latest
Step #3: Run a Docker Container
Setting up a basic Fedora container with a bash shell requires a single command, “docker”:
docker run -i -t fedora /bin/bash
Breaking down that command:
- docker run will run a command in a new container
- -i attaches stdin and stdout
- -t allocates a tty
- fedora indicates that we’ll be using the standard Fedora container
- /bin/bash provides us with our shell
That’s it! You’re now using a bash shell inside of a Fedora Docker container.
To disconnect, or detach, from the shell without exiting, use the escape sequence: Ctrl + p followed by Ctrl + q.
You can easily search for other community containers. Here, we are searching for the keyword “fedora”:
docker search fedora
Step #4: Get More Out of Docker
Learn more about Docker by reviewing the official documentation.