Docker is a platform for developing, building, delivering, and running applications in containers. With containerization, you can make your applications independent of the infrastructure and ensure their fast and consistent container deployment. The value of the platform for DevOps is the ability to deploy a fully isolated application on multiple servers.
For now, Docker technology offers all the tools you need to build your application images from Dockerfile and run them in an isolated environment.
Beget VPS with pre-installed Docker is a ready-to-use distribution with Docker and Docker Compose installed: build, test, and deploy your applications immediately after the virtual server is created, using containers.
Installation package information
- Ubuntu 22.04
- Docker CE, the latest version
- Docker Сompose, the latest version
Docker installation instruction
You do not need to specify any additional parameters when creating a server. After creating the virtual server, it will take 1–3 minutes to deploy the latest version of Docker on it. The installation status will be displayed in the control panel. After the Docker installation is complete, you will receive a notification.
Using Docker
To verify that the Docker platform is deployed correctly, follow these steps:
- Connect to your server via SSH by its IP address, using
rootas the login. Windows users may need to install an SSH client (such as Putty). - To check if Docker is installed correctly, you can run a simple container with the command
docker run hello-world. Make sure that the images are downloaded and launched correctly and that the container runs without errors:
root@docker-host1:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:7d246653d0511db2a6b2e0436cfd0e52ac8c066000264b3ce63331ac66dca625
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/After a successful installation, Docker containerization can be used without restrictions. We wish you good luck with Docker containers!
FAQ
To enter a running container or execute a command in its environment, use docker exec:
- Find the ID or name of the desired container using the
docker pscommand:
root@docker-host1:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fc0e883605c3 ubuntu:latest "/bin/sleep 1000" 2 minutes ago Up 2 minutes lucid_bouman- To execute an arbitrary command in a container, use the command
docker exec <container id|name> <command>:
root@docker-host1:~# docker exec fc0e883605c3 ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2788 1056 ? Ss 12:37 0:00 /bin/sleep 1000
root 32 0.0 0.0 7060 1588 ? Rs 12:41 0:00 ps auxwhere fc0e883605c3 is the container ID, ps aux is the required command
- To execute interactive commands (such as running a bash shell in the container environment), use the command
docker exec -it <container id|name> <command>:
root@docker-host1:~# docker exec -it fc0e883605c3 bash
root@fc0e883605c3:/# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2788 1056 ? Ss 12:37 0:00 /bin/sleep 1000
root 38 0.0 0.1 4628 3864 pts/0 Ss 12:43 0:00 bash
root 47 0.0 0.0 7060 1600 pts/0 R+ 12:43 0:00 ps auxbash shell, but only the sh shell.To restart a container, use docker restart:
- Find the ID or name of the desired container using the
docker pscommand:
root@docker-host1:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fc0e883605c3 ubuntu:latest "/bin/sleep 1000" 2 minutes ago Up 2 minutes lucid_bouman- To restart the desired container, use the command
docker restart <container id|name>:
root@docker-host1:~# docker restart fc0e883605c3
fc0e883605c3To remove all stopped containers, use the command docker container prune:
root@docker-host1:~# docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
8618a56f1accf627945ce95c4dae94ad15cb369cfaba9f0867aaccf7b7b8d2ae
55cfa3754b062c9055d5a97bf0de2c13eecc77d74c5846bb066ab24512cb72c5
fc0e883605c38d811cae890b244e2f6776b507e00e02fe802e53c82ec29fe876
86ce4a4f6cbe2be88c31163babde317d99de8fb536ae77d62a7254fc1ad2d3d1
Total reclaimed space: 10M
docker volume prune.