Docker Images 內的狀態查看方式
因為愈來愈多的機會會取用到 Docker Hub 上的 images , 所以整理一下可以快速用這個 image 啟動一個 docker container 來看 images 內的系統版本與檔案相關路徑等資訊
基本語法
- docker run -i -t <image> <shell cmd> Exp. php image
docker run -i -t php:7.0.33-cli-jessie bash
- 查看作業系統版本
root@ef8c2a5ab946:/# cat /etc/issue Debian GNU/Linux 8 \n \l
- 查看 php 版本與路徑
root@ef8c2a5ab946:/# php -v PHP 7.0.33 (cli) (built: Dec 29 2018 07:12:20) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies root@ef8c2a5ab946:/# which php /usr/local/bin/php root@ef8c2a5ab946:/usr/local/src# ls -l /usr/local/ total 40 drwxrwsr-x 1 root staff 4096 Dec 29 2018 bin drwxrwsr-x 1 root staff 4096 Dec 29 2018 etc drwxrwsr-x 2 root staff 4096 Dec 26 2018 games drwxrwsr-x 1 root staff 4096 Dec 29 2018 include drwxrwsr-x 1 root staff 4096 Dec 29 2018 lib lrwxrwxrwx 1 root staff 9 Dec 26 2018 man -> share/man drwxr-sr-x 3 root staff 4096 Dec 29 2018 php drwxrwsr-x 2 root staff 4096 Dec 26 2018 sbin drwxrwsr-x 1 root staff 4096 Dec 29 2018 share drwxrwsr-x 2 root staff 4096 Dec 26 2018 src drwxr-sr-x 4 root staff 4096 Dec 29 2018 var
- 目前有哪些 php 模組
root@bd62f18ef84e:/# php -m [PHP Modules] Core ctype curl date dom fileinfo filter ftp hash iconv json libxml mbstring mysqlnd openssl pcre PDO pdo_sqlite Phar posix readline Reflection session SimpleXML SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules]