LoginSignup
1
0

More than 3 years have passed since last update.

Docker書き方メモ

Last updated at Posted at 2020-08-09

Dockerの書き方メモ

dockercompose

version: '3'
services:
    test1:
        build: ./build
        container_name: test1
        ports:
            - 8080:80

    test2:
        image:
        container_name: test2
        volumes:
            - ./test:/var
        ports:
            - 8000:8000
docker-compose up -d

Dockerコマンド

Docker内へ入る

docker exec -it test /bin/bash
exit

コンテナ一覧を表示

docker ps
docker ps -a

コンテナを停止

docker stop test

コンテナを起動

docker start test

コンテナを削除

docker rm test

停止コンテナ、タグ無しイメージ、未使用ボリューム、未使用ネットワーク一括削除

docker system prune

すべてのコンテナを停止

docker stop $(docker ps -q)

すべてのコンテナを削除

docker rm $(docker ps -q -a)

すべてのイメージを削除する

docker rmi $(docker images -q) -f
1
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
1
0