1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker 初心者チートシート

Last updated at Posted at 2021-03-15

Docker 初心者のためのチートシート

このページは随時更新していきます。
ターミナルでのコマンド一覧です。

ログイン

$ docker login

Pullする

$ docker pull {IMAGE_NAME:TAG_NAME}

Docker imageのリストの確認

$ docker images 

コンテナに入る

// すでにあるコンテナに入る
$ docker exec {CONTAINER_NAME}

// 動いているコンテナに入る
$docker exec -it {CONTAINER_NAME} bash

Runの一覧

// imageからコンテナを作る
$ docker run {IMAGE_NAME}

// imageからコンテナを作ってから入る 
$ docker run -it {IMAGE_NAME:TAG_NAME} bash

// すでにあるコンテナを指定してrun
$ docker run --name {CONTAINER_NAME} -it {IMAGE_NAME:TAG_NAME} bash

コンテナの確認

$ docker ps -a

ファイルの作成

touch {FILE_NAME}

コンテナから出る

// 完全に出る
$ exit

// 「コンテナを動かしたままにしたい」「止めたくない」という場合
command + p + q
(コマンドでなく、ショートカット)

リスタート

$ docker restart {CONTAINER_NAME or ID}

コミット

$ docker commit {CONTAINER_NAME or ID} {NEW_Docker_image_NAME}
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?