1. After entering the container cat /etc/hosts It will show the IP address of the container itself and the (- link) soft link. 2. Use commands docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container-ID> or docker inspect <container id> or docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id 3. Consider writing a bash function in ~/.bashrc: function docker_ip() { sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1 } source ~/.bashrc and then: $ docker_ip <container-ID> 172.17.0.6 4. To get all container names and their IP addresses just one command is needed. docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(docker ps -aq) If you use docker-compose the command will be: docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq) 5. Display all container IP addresses: docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq) The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: How to write a Node.JS version of a game
>>: MySQL 5.7.18 MSI Installation Graphics Tutorial
Today I have a question about configuring MySQL d...
1. Introduction The requirement is to obtain the ...
Application scenario: It is necessary to count th...
This article shares the specific code of Vue usin...
I'm using a placeholder in a text input and i...
CSS Operations CSS $("").css(name|pro|[...
Table of contents Overview Functionality and read...
The first step is to add the corresponding databa...
I won’t go into details about the theory of UDP. ...
Enter the mysql command: mysql -u+(user name) -p+...
I installed MySQL smoothly in Ubuntu 16.04 before...
Table of contents 1. How to locate and optimize s...
Table of contents 1. Install html2Canvas 2. Intro...
Table of contents 1. Using Set()+Array.from() 2. ...
Start a new project This article mainly records t...