LoginSignup
3
4

More than 5 years have passed since last update.

【Docker】Dockerでよく使われるコマンド一覧

Posted at

Docker imageの確認

command
docker images

Dockerへのログイン

command
docker login

Docker imageの取得

command
docker pull <Repository>

Dockerコンテナの稼働状況を確認

command
docker ps

コンテナの稼働

command
docker run -it d --name <コンテナ名> <Repository名>
docker exec -it <コンテナ名> /bin/bash

コンテナから抜く

command
(コンテナに入っている状態)ctrl + p,q

コンテナへの再度ログイン

command
docker attach <コンテナ名>

コンテナの終了

command
exit

コンテナの起動

command
docker start <コンテナのIDまたは名>

コンテナの停止

command
docker stop <コンテナのIDまたは名>

コンテナの削除

command
docker rm <コンテナID>

imageの削除

command
docker rmi <image ID>
docker image prune(※TAGがNoneの場合)

コンテナの保存

command
docker commit -m "commit message" <コンテナID> <imageID>:TAG

Docker Hubへのプッシュ

command
docker tag local-image:tagname new-repo:tagname
docker push new-repo:tagname

ファイルのコピー

command
1.ローカルからコンテナへ
docker cp file <コンテナ名>:/path/file
2.コンテナからローカルへ
docker cp <コンテナ名>:/path/file file

Dockerの容量拡張

command
docker-machine rm default
docker-machine create -d virtualbox --virtualbox-disk-size "10000" default (※100GB)
3
4
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
3
4