How to check the container IP address in Docker?

青灯夜游
Release: 2020-08-19 16:32:54
Original
24071 people have browsed it

View method: 1. Use the "docker inspect --format='{{.NetworkSettings.IPAddress}}'" command; 2. Use the "docker exec -it ID/NAMES ip addr" command.

How to check the container IP address in Docker?

[Related recommendations:Docker video tutorial]

View the underlying information of Docker.

docker inspect will return a JSON file recording the configuration and status information of the Docker container

docker inspect NAMES # 查看容器所有状态信息; docker inspect --format='{{.NetworkSettings.IPAddress}}' # 查看 容器ip 地址 docker inspect --format '{{.Name}} {{.State.Running}}' # 容器运行状态
Copy after login

View process information

docker top NAMES
Copy after login

View port; (use container ID or container name)

docker port ID/NAMES
Copy after login

You can also check the IP address directly by using remote execution command(Centos7);

docker exec -it ID/NAMES ip addr
Copy after login

For more programming-related knowledge, please visit:Introduction to Programming! !

The above is the detailed content of How to check the container IP address in Docker?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!