2.36. Docker exec command

发布时间 :2025-10-25 12:31:06 UTC      

Docker 命令大全

docker exec : Execute commands in the running container

2.36.1. Grammar

docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

OPTIONS description:

  • -d : Split mode: running in the background

  • -i : Keep STDIN open even if there is no attachment

  • -t : Assign a pseudo terminal

2.36.2. Example

Execute the in-container / root/runoob.sh script in interactive mode in the container mynginx:

runoob@runoob:~$ docker exec -it mynginx /bin/sh /root/runoob.sh
http://www.runoob.com/

Open an interactive mode terminal in the container mynginx:

runoob@runoob:~$ docker exec -i -t  mynginx /bin/bash
root@b1a0703e41e7:/#

You can also use the docker ps-a command to see which containers are already running, and then use the container ID to enter the container.

Check the container ID that is already running:

# docker ps -a
...
9df70f9a0714        openjdk             "/usercode/script.sh…"
...

The 9df70f9a0714 in the first column is the container ID.

Bash the specified container through the exec command:

# docker exec -it 9df70f9a0714 /bin/bash

Docker 命令大全

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.