How to enter docker container

王林
Release: 2020-06-30 17:58:21
forward
3504 people have browsed it

How to enter docker container

You can use docker attach to enter the Docker container.

(Recommended learning: docker tutorial)

The details are as follows:

Docker provides the attach command to enter the Docker container.

How to enter docker container

Next we create a daemon Docker container, and then use the docker attach command to enter the container.

$ sudo docker run -itd ubuntu:14.04 /bin/bash
Copy after login

How to enter docker container

Then we use docker ps to view the container information, and then use docker attach to enter the container

$ sudo docker attach 44fc0f0582d9
Copy after login

How to enter docker container

You can see that we have entered the container.

But there is a problem with using this command. When multiple windows use this command to enter the container at the same time, all windows will be displayed simultaneously. If one window is blocked, other windows will no longer be able to operate. Come on, let's demonstrate. Open two windows and use the attach command to enter the same container. As shown below:

How to enter docker container

# Next we only operate in the first window. You can see that the operations in the first window are synchronized to the second window, as follows :

How to enter docker container

For this reason, the docker attach command is not suitable for production environments. You can use this command when developing your own applications.

The above is the detailed content of How to enter docker container. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template