Chromebook に Docker をインストールするコマンド一覧
入力するターミナル
1. Chrome OS の設定2. 詳細設定
3. デベロッパー Linux 開発環境(ベータ版)
4. オンにする
5. ランチャーのLinux アプリ
6. ターミナル起動
パッケージのインストール
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
パッケージ | 詳細 |
---|---|
apt-transport-https | AHTTPSプロトコルでパッケージを取得するトランスポートメソッド |
ca-certificates | SSL/TLS通信時に使用される証明書を管理 |
curl | コマンドラインからデータを転送 |
gnupg-agent | GNU Privacy Guard エージェント |
software-properties-common | ソフトウェアリポジトリ管理ツール |
GPG公開鍵を登録
※GPGとは?: Docker のデジタル署名技術. パッケージが正当なものか確認するために必要.$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
コマンド | 詳細 |
---|---|
https://download.docker.com/linux/ubuntu/gpg | GPG公開鍵URL |
sudo apt-key add - | 公開鍵をシステムに登録 |
フィンガープリント表示
※フィンガープリントとは?:、GPG公開鍵の識別子.デジタル署名を検証するために必要.$ sudo apt-key fingerprint 0EBFCD88
コマンド | 詳細 |
---|---|
fingerprint | フィンガープリント表示 |
0EBFCD88 | Dockerの公式GPG公開鍵識別子 |
リポジトリを追加
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
コマンド | 詳細 |
---|---|
add-apt-repository | APT を使用してソフトウェアリポジトリを追加 |
https://download.docker.com/linux/debian https://download.docker.com/linux/ubuntu |
Docker公式リポジトリURL |
[arch=amd64] | アーキテクチャを指定 |
$(lsb_release -cs) | Debianリリースのコードネームを動的に取得 |
stable | Docker 安定版リリース |
リポジトリ更新
$ sudo apt-get update
Docker インストール
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
パッケージ | 詳細 |
---|---|
docker-ce | Dockerコアコンポーネントとツール |
docker-ce-cli | Dockerコマンドラインインターフェースパッケージ |
containerd.io | containerdパッケージ(コンテナ実行に必要) |
インストールできたかバージョン確認
$ docker --version
Docker version 24.0.5, build ced0996
無事インストール完了
Ex: コマンド入力した際に何かメッセージが・・・
$ docker ps
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
Dockerコマンドを実行するには,Dockerグループに所属している必要あり.
Dockerデーモンは, DockerグループのメンバーのみがDockerコマンドを実行できるように制限されている.
$ sudo usermod -aG docker <ユーザー名>
※ユーザー名は現在ログインしているユーザー名に変更 ubuntu@ip-0-0-0-0 = ubuntu
コードを実行したら一度ログアウトして再度ログイン (1敗)
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
コマンド成功
面倒でなければ sudo をつけても実行可能