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?

おうちサーバー構築報告:Docker on ProxmoxVE

Posted at

能書き

おうちサーバー構築報告:予告からのおうちサーバー構築です。

前提

目標

  • Proxmox VE 上の仮想マシンに Docker をインストール
    • docker compose でhello-worldを実行して動作確認

参考文献

今回の設定に必要な事前準備などは下記になります。

Dockerインストール手順は下記記事を参照させていただきました。

また今回、rootユーザー以外でDockerを使う為のユーザーグループを設定します。

その他、エラーへの対応など。

インストール

まずはパッケージリストの更新。

sudo apt update

依存パッケージをインストールします。

sudo apt install ca-certificates curl

Dockerリポジトリの公開鍵をUbuntu推奨ディレクトリへ格納します。

sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Dockerの公式リポジトリをシステムに追加します。

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc]  https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Docker Engineをインストールします。

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

動作確認。

docker --version
docker compose version

Dockerグループ設定

rootユーザー以外でDockerを使う為のユーザーグループを設定します。

まず、dockerグループが存在する事を確認します。

grep docker /etc/group

存在しないならdockerグループを作成しましょう。もし既に存在していたらそのまま放置でOKです。

sudo groupadd docker

ユーザーにdockerグループを付加します。

sudo usermod -aG docker $USER

そうしたら一旦ログアウトして、ログインしなおします。または次のコマンドを実行します。

newgrp docker

sudoを付けずにdockerできる筈です。

docker run hello-world

docker compose も一応確認しておきましょう。

cd
mkdir hello-world
cd hello-world
cat <<___ >compose.yaml
services:
  hello:
    image: hello-world:latest
___
docker compose up -d
docker compose logs

仕舞い

Ubuntuインストール時のdockerの指定は、snapからのインストールになり、コンテナの置き場所に制限が掛かるようです。こんなバッドノウハウがあるとは…悲しいですな。

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?