19
17

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]docker inspcetコマンドでコンテナの情報を確認する

Posted at

メモ

参考

環境

$docker ps -a|grep php
c4b8b85ba97c        php:fpm                          "docker-php-entrypoin"   2 hours ago         Up 2 hours          9000/tcp                      ecs-awseb-elasticBeanstalk2-env-multi2-ajn48eitej-1-php-app-d693be93a7babe92cb01

事前にコンテナIDを確認しておく

--format オプションについて

Go の text/template packageを使っているようで詳細はこちらを見れば分かるようです。

やってみる

全部見る

$docker inspect c4b8b85ba97c

# less で確認しながら
$docker inspect c4b8b85ba97c |less

コンテナで利用しているIPアドレス取得

$docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' c4b8b85ba97c
172.17.0.2

コンテナに設定されている環境変数の取得

$docker inspect --format='{{range .Config.Env}}{{println .}}{{end}}' c4b8b85ba97c
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PHPIZE_DEPS=autoconf            file            g++             gcc            libc-dev                 make            pkg-config              re2c
PHP_INI_DIR=/usr/local/etc/php
PHP_EXTRA_CONFIGURE_ARGS=--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2
PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2
PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie
GPG_KEYS=A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
PHP_VERSION=7.1.0
PHP_URL=https://secure.php.net/get/php-7.1.0.tar.xz/from/this/mirror
PHP_ASC_URL=https://secure.php.net/get/php-7.1.0.tar.xz.asc/from/this/mirror
PHP_SHA256=a810b3f29c21407c24caa88f50649320d20ba6892ae1923132598b8a0ca145b6
PHP_MD5=cf36039303c47f493100afea522a8f53
19
17
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
19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?