まずはイメージ取得する
[root@centos8_1 ~]# docker image pull centos
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Resolved "centos" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/centos/centos:latest...
Getting image source signatures
Copying blob 7a0437f04f83 done
Copying config 300e315adb done
Writing manifest to image destination
Storing signatures
300e315adb2f96afe5f0b2780b87f28ae95231fe3bdd1e16b9ba606307728f55
[root@centos8_1 ~]#
イメージを取得できたことを確認する
[root@centos8_1 ~]# docker image list
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
REPOSITORY TAG IMAGE ID CREATED SIZE
quay.io/centos/centos latest 300e315adb2f 3 years ago 217 MB
[root@centos8_1 ~]#
イメージ(centos)からコンテナを起動する
名前をtestos1にしています。
[root@centos8_1 ~]# docker run -it --name testos1 centos /bin/bash
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[root@2269307d2760 /]#
コンテナを停止せずに画面からログアウト?する方法
ctrl +P + Q
停止していないことを確認する
[root@centos8_1 ~]# docker ps -a
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2269307d2760 quay.io/centos/centos:latest /bin/bash 2 minutes ago Up About a minute ago testos1
コンテナを停止する
[root@centos8_1 ~]# docker stop testos1
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
testos1
[root@centos8_1 ~]# docker ps -a
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@centos8_1 ~]#
コンテナを起動する
オプションの説明
[root@centos8_1 ~]# docker start -ai testos1
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
testos1
[root@centos8_1 ~]#
[root@centos8_1 ~]#
[root@centos8_1 ~]# docker ps -a
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2269307d2760 quay.io/centos/centos:latest /bin/bash 10 minutes ago Up 7 seconds ago testos1
[root@centos8_1 ~]#
起動後のログイン方法
[root@centos8_1 ~]# docker attach testos1
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[root@2269307d2760 /]#
[root@2269307d2760 /]#
[root@2269307d2760 /]#
[root@2269307d2760 /]#
イメージ一覧を検索したい場合
[root@docker163 ~]# docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos DEPRECATED; The official build of CentOS. 7751 [OK]
centos/postgresql-10-centos7 PostgreSQL is an advanced Object-Relational … 20
centos/systemd systemd enabled base container. 115 [OK]
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 45
centos/redis-5-centos8 0
centos/postgresql-10-centos8 0
centos/httpd-24-centos8 3
centos/mariadb-103-centos8 2
centos/postgresql-12-centos8 0
centos/mysql-56-centos7 MySQL 5.6 SQL database server 23
centos/mongodb-36-centos7 MongoDB NoSQL database server 12
centos/mariadb-101-centos7 MariaDB 10.1 SQL database server 13
centos/mysql-80-centos8 0
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 16
centos/ruby-25-centos7 Platform for building and running Ruby 2.5 a… 3
centos/redis-32-centos7 Redis in-memory data structure store, used a… 6
centos/mysql-57-centos7 MySQL 5.7 SQL database server 95
centos/mariadb-102-centos7 MariaDB 10.2 SQL database server 6
centos/httpd-24-centos7 Platform for running Apache httpd 2.4 or bui… 46
centos/php-56-centos7 Platform for building and running PHP 5.6 ap… 34
centos/python-27-centos7 Platform for building and running Python 2.7… 17
centos/nginx-116-centos7 Platform for running nginx 1.16 or building … 3
centos/nginx-18-centos7 Platform for running nginx 1.8 or building n… 14
centos/redis-5-centos7 Redis in-memory data structure store, used a… 0
centos/postgresql-12-centos7 PostgreSQL is an advanced Object-Relational … 5
続編
参考