全部博文(1159)
分类: 虚拟化
2016-03-04 08:01:04
Docker is a container-based software framework commonly used for automating deployment of applications. Containers are encapsulated, lightweight, and portable application modules.
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.
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
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:
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
Learn more about Docker by reviewing the official documentation.