28
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerコンテナの内部IPアドレスを確認する方法

Posted at
  • 環境
    • Dockerホスト:
      • CentOS Linux release 7.6.1810 (Core)
      • Docker version 18.09.6, build 481bc77156
    • Dockerコンテナ
      • CentOS Linux release 7.6.1810 (Core)

1.ホスト側でコンテナIDを確認する

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
{コンテナID}        1a83763d4bd9        "/usr/sbin/init"    2 days ago          Up About an hour    0.0.0.0:8082->8080/tcp   {コンテナ名}

2.実行中のコンテナに入る

$ docker exec -it {コンテナID} /bin/bash

3.コンテナ内でIPアドレスを確認する

$ hostname -i
123.45.0.3

参考

28
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?