Home  >  Article  >  Operation and Maintenance  >  How to check the container IP address in Docker?

How to check the container IP address in Docker?

青灯夜游
青灯夜游Original
2020-08-19 16:32:5424394browse

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}}' 
# 容器运行状态

View process information

docker top NAMES

View port; (use container ID or container name)

docker port ID/NAMES

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

docker exec -it ID/NAMES ip addr

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!

Statement:
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