docker常用コマンドノート1
2889 ワード
一、dockerを実行する
二、dockerの表示
三、容器の再起動
四、停止した容器を削除する
五、守る形で容器を運ぶ
六、コンテナログの表示
七、容器中のプロセス
八、ウェブサイトの配置
九、容器を再起動するとIPとポートマッピングが変わる可能性がある
十、検索ダウンロードミラー
十一、docker commit構築ミラー
docker run --name fedora-kivy -i -t ubuntun /bin/bash
二、dockerの表示
docker ps -a
docker inspect
三、容器の再起動
docker start -i container01
四、停止した容器を削除する
docker rm containername
五、守る形で容器を運ぶ
#
docker run -i -t IMAGE /bin/bash
ctrl-p ctrl-q
docker attach fedora-kivy #
#deamon
sudo docker run --name dc1 -d centos /bin/bash
docker stop dc1# dc1
docker kill dc1
六、コンテナログの表示
docker logs -tf --tail 10 dc1
-f --follows = True | False #
-t --timestamps=True | False #
--tail = 'all' #
七、容器中のプロセス
docker top
docker exec -i -t dc /bin/bash
八、ウェブサイトの配置
docker run -p 80 -i -t centos /bin/bash
docker run -p 8080:80 -i -t centos /bin/bash
docker run -p 80 --name myweb -i -t centos /bin/bash
nginx
yum install -y nginx,vim
mkdir /var/www/html
vim index.html
nginx root
nginx
九、容器を再起動するとIPとポートマッピングが変わる可能性がある
十、検索ダウンロードミラー
[root@linux leo]# docker search centos
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/centos The official build of CentOS. 4845 [OK]
docker.io docker.io/centos The official build of CentOS. 4845 [OK]
docker.io docker.io/ansible/centos7-ansible Ansible on Centos7 118 [OK]
docker.io docker.io/ansible/centos7-ansible Ansible on Centos7 118 [OK]
docker.io docker.io/jdeathe/centos-ssh CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x... 99 [OK]
docker.io docker.io/jdeathe/centos-ssh CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x... 99 [OK]
docker.io docker.io/consol/centos-xfce-vnc Centos container with "headless" VNC sessi... 65 [OK]
docker.io docker.io/consol/centos-xfce-vnc Centos container with "headless" VNC sessi... 65 [OK]
docker.io docker.io/imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 47 [OK]
docker.io docker.io/imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 47 [OK]
#
[root@linux leo]# docker pull centos:7.5
Trying to pull repository docker.io/library/centos ...
十一、docker commit構築ミラー
docker commit -a "author's name" -m "image info" centos-nginx dormancypress/centos-nginx