Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

4
6

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/ECR/ECS】 コンテナ入門まとめ①

Last updated at Posted at 2020-05-18

後編

参考文献

Docker 基本コマンド

イメージの取得

$ docker images [リポジトリ名]  ※リポジトリ名:DockerHubアカウントで作成

<例>
$ docker images username/sample

タグ設定

$ docker tag [イメージ名]:タグ名 ユーザ名/[イメージ名]:タグ名

<例>
$ docker tag testimage:1.0 username/testimage:1.0

DockerHubアップロード

$ docker login   ※DockerHubログイン

$ docker push ユーザ名/[イメージ名]:タグ名

<例>
$ docker push username/testimage:1.0

コンテナ作成/起動

$ docker run [オプション] イメージ名[:タグ名] [引数]

<例>
$ docker run -it --name "sample" testimage /bin/bash

稼働中のコンテナに接続

$ docker attach コンテナ名

<例>
$ docker attach sample   ※プロセス終了:ctrl + P,Q

AWS上でDockerを使用する場合

Dockerインストール

$ sudo yum update -y

$ sudo amazon-linux-extras install docker

Docker起動

$ sudo service docker start
         or
$ sudo systemctl start docker

dockerグループにユーザ追加

$ sudo usermod -a -G docker ec2-user

dockerアクセス確認

$ docker info

"No space left on device" エラー対処

ファイル数の消費量を表示

$ sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

未使用のコンテナ/イメージ/ボリュームの一括削除

$ docker system prune -af --volumes
4
6
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

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?