Help us understand the problem. What is going on with this article?

Dockerを使ってみよう(Ubuntu編)

More than 1 year has passed since last update.

Dockerインストールとちょっとした使い方のメモ
CentOS編はこっち→ https://qiita.com/itiB_S144/items/01a35e574dc3ce7a764b

インストール編

参考ページ https://knowledge.sakura.ad.jp/13795/

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

docker公式の公開鍵もってくる

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

鍵の確認

sudo apt-key fingerprint 0EBFCD88
pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22

あるのが確認できたらOK

インストールするよ

sudo apt-get install -y docker-ce

起動するんゴ

systemctl start docker

イメージ一覧の確認

docker image

コンテナの状態確認

docker ps -a

イメージの起動

docker run <hello-world>

イメージだけ持ってくる

docker pull <hello-world>

コンテナを消す

docker rm <コンテナの名前orID>

イメージを消す

docker rmi <イメージ名>

nginx起動してみたくない?

docker pull nginx
docker run -d --name nginx-container -p 8181:80 nginx
  • -d バックグラウンド実行
  • --name 名前つけれるよ
  • -p ホストとコンテナ間のポートフォワード設定
curl http://127.0.0.1:8181/index.html

見れたv('ω')v

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away