LoginSignup
0
0

Docker コマンドまとめ

Posted at

Dockerコマンドまとめ

docker runを実行する

# Dockerイメージを指定して、名前を定義して実行する(Pythonを実行してすぐに終了する)
docker run --name test4 python:1.1
hello world!

実行結果

1.png

Dockerコンテナを削除する

# Dockerを実行(イメージからコンテナを作成して実行する)
docker run --name test4 python:1.1
# コンテナを削除する 
docker rm test4

インターラクティヴでコンテナを起動して、処理終了したら、コンテナを閉じる

$ docker run --rm -it python:1.1 
hello world!

[ -i ]オプション : interactive ( 対話型 )
[ -t ]オプション : tty ( 端末デバイス )

Ubuntuのコンテナを作成して、起動する

$ docker run -it ubuntu
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
3153aa388d02: Already exists                                                                                                            
Digest: sha256:0bced47fffa3361afa981854fcabcd4577cd43cebbb808cea2b1f33a3dd7f508
Status: Downloaded newer image for ubuntu:latest
root@e9c178678abb:/# ls
bin  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@e9c178678abb:/#   
0
0
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
0
0