• Smaller than VMs • Improved performance • Secure • Flexible
Not only for the cloud environment, Docker can also be quite useful for end users, especially when you want to test out particular software under a specific Linux environment. You can easily spin up a Docker container for the target environment, install and test the software in it, and then throw away the container once you are done. The whole process from beginning to end is quite efficient, and you can avoid messing up your end system all along.
In this post, I am going to describe how to create and manage Docker containers on Fedora.
To install Docker on Fedora, use the following commands:
# yum install docker-io
# systemctl start docker.service
# systemctl enable docker.service
Basic Usage of Docker
To start a new Docker container, you need to decide which Docker image to use for the container. You can search the official Docker image index which lists publicly available Docker images. The Docker index includes Linux base images managed by Docker team (e.g., Ubuntu, Debian, Fedora, CentOS), as well as user-contributed custom images (e.g., MySQL, Redis, WordPress).
For example, to start a Fedora/Ubuntu container in the interactive mode, run the following command. The last argument '/bin/bash' is to be executed inside a container upon its launch.
docker run -i -t ubuntu /bin/bash or docker pull ubuntu /docker pull fedora
The first time you run the above command, it will download available Ubuntu docker image(s) over networks, and then boot up a Docker container using the image. A Ubuntu container will boot up instantly, and you will see a console prompt inside the container. You can access a full-fledged Ubuntu operating system inside the container sandbox.
list of all containers
docker ps -a
Start container of your choice
docker start [container-id]
Remove container from you local repo
docker rm [container-id]
Running container in order to view or interact with the container
docker attach [container-id]
To remove a container image from the local repository:
docker rmi [image-id]
To search a container image from repositry
docker search fedora or docker search centos