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?

More than 3 years have passed since last update.

Install docker, docker-compose for debin10

Last updated at Posted at 2020-09-27

目的

  • インストール
    • docker
    • docker-compose
  • docker data 保存先ディレクトリを移動する

Install docker

  • uninstall olds
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
  • setup repository
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    gnupg2 \
    software-properties-common

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

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"
  • install docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Install docker-compose

  • install compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# インストール後にdocker-composeコマンドが失敗した場合は、パスをチェックします
# また、パス内の /usr/bin やその他のディレクトリへのシンボリックリンクを作成するなど
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

no sudo

  • sudo 無しで実行可能とする
sudo groupadd docker
sudo gpasswd -a $USER docker

docker data ディレクトリ移動

  • /etc/default/docker
# ファイル末尾に追加. -g の後に、docker data 保存先ディレクトリを指定
OPTIONS="-g /opt/docker"
  • /lib/systemd/system/docker.service
# option file 読み込み
EnvironmentFile=/etc/default/docker

# ExecStart 行の末尾に $OPTIONS を追記
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock $OPTIONS
  • realod
sudo systemctl daemon-reload
sudo systemctl restart docker

参考サイト

https://docs.docker.com/engine/install/
https://mebee.info/2020/04/13/post-8593/
https://www.codeflow.site/ja/article/how-to-install-and-use-docker-on-debian-10
https://qiita.com/DQNEO/items/da5df074c48b012152ee

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?