ざっくりDocker その1
Dockerのざっくりめも。
docker image検索
$ docker search centos NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 4871 [OK] ansible/centos7-ansible Ansible on Centos7 119 [OK] jdeathe/centos-ssh CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x86… 99 [OK] consol/centos-xfce-vnc Centos container with "headless" VNC session… 67 [OK] imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 47 [OK] tutum/centos Simple CentOS docker image with SSH access 43 centos/mysql-57-centos7 MySQL 5.7 SQL database server 40 gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glust… 37 [OK] openshift/base-centos7 A Centos7 derived base image for Source-To-I… 35 centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 33 centos/python-35-centos7 Platform for building and running Python 3.5… 32 kinogmt/centos-ssh CentOS with SSH 22 [OK] openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use w… 18 centos/php-56-centos7 Platform for building and running PHP 5.6 ap… 16 pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag names… 8 openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for use … 6 openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x ima… 4 darksheer/centos Base Centos Image -- Updated hourly 3 [OK] pivotaldata/centos-mingw Using the mingw toolchain to cross-compile t… 2 pivotaldata/centos Base centos, freshened up a little with a Do… 2 blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK] smartentry/centos centos with smartentry 0 [OK] pivotaldata/centos7-test CentosOS 7 image for GPDB testing 0 pivotaldata/centos7-build CentosOS 7 image for GPDB compilation 0 pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated wi… 0
docker image ダウンロード
(例)centosのlatestイメージをダンロード
$ docker pull centos:latest latest: Pulling from library/centos aeb7866da422: Pull complete Digest: sha256:67dad89757a55bfdfabec8abd0e22f8c7c12a1856514726470228063ed86593b Status: Downloaded newer image for centos:latest
ダウンロードイメージの確認
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos latest 75835a67d134 3 weeks ago 200MB
コンテナ起動
(例)centosのイメージを元に「"docker run test"」を表示するコンテナ起動
$ docker run centos:latest echo 'docker run test' docker run test
(例)centosのイメージを元にコンテナ起動 オプションの-itで実行したコンテナで作業ができる。
$ docker run -it centos:latest /bin/bash [root@fd3c1abd7c42 /]#
exitコマンドで終了した場合は、コンテナも終了する。
control + p + q で終了した場合はコンテを終了しないで抜ける。
起動中のコンテナを確認
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9f79e05f1056 centos:latest "/bin/bash" 16 seconds ago Up 15 seconds inspiring_blackwell
control+p+q抜けたコンテンが確認できる。
起動中のコンテナへ接続
(例)コンテナID:9f79e05f1056へ接続する
$ docker attach 9f79e05f1056 [root@9f79e05f1056 /]#