0
0

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 1 year has passed since last update.

Docker汎用コマンド集

Posted at

Docker汎用コマンド集

  • Apacheコンテナを作成、実行
docker container run --name myapache -d -it -p 8000:80 -v /tmp:/usr/local/apache2/htdocs httpd

  • コンテナ内にファイルをコピー
sudo docker cp コンテナID:コピー先パス コピー元パス
sudo docker cp コピー元パス コンテナID:コピー先パス

  • コンテナにボリュームをマウント
docker run -it --mount source=ボリューム名,target=マウント先パス イメージ名:Tag名

  • コンテナをすべて削除
docker rm -f $(docker ps -a -q)

  • イメージをすべて削除
docker rmi -f $(docker images -q)

  • ボリュームをすべて削除
docker volume rm $(docker volume ls -q)

  • 起動中のコンテナにコマンドを実行する
docker exec -it コンテナ名 /bin/bash
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?