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のインストール

必要パッケージをインストール

sudo dnf install -y dnf-plugins-core

Docker の公式リポジトリを追加

sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Docker Engine をインストール

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

Docker を起動 & 自動起動

sudo systemctl enable --now docker

動作確認

docker --version
# hello-worldコンテナが動くか確認
sudo docker run hello-world

コンテナが稼働したらOK。

Dockerイメージのビルド・コンテナ作成

Dockerfile・docker-compose.ymlを含むリポジトリがGitHubにパブリックリポジトリとして存在することを前提に、以下を実行。

gitをインストール

sudo dnf install -y git

gitリポジトリをclone

git clone https://github.com/username/your-repo.git
cd your-repo

docker-compose.ymlを実行

docker compose up -d

このコマンドでサーバー再起動時のコンテナ自動再起動もしてくれる。

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?