5

树莓派安装 docker 和 docker-compose

 2 years ago
source link: https://blog.lucien.ink/archives/518/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
请注意,本文编写于 456 天前,最后修改于 174 天前,其中某些信息可能已经过时。

树莓派安装 docker 和 docker-compose

本文地址:blog.lucien.ink/archives/518

因为总是频繁地初始化树莓派,所以把安装 docker 的过程也记录下来。

1. 安装 docker

因为某些不可抗因素,强烈建议在安装 docker 之前先重启一下系统。

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

2. 安装 docker-compose

为了不破坏系统的 python interpreter,这里选择将 docker-compose 装在 venv 里。

当然了,对此不介意的小伙伴可以跳过 venv 的安装,直接看 2.2 节。

2.1 创建并使用 venv

2.1.1 安装 venv 依赖

apt install python3-venv -y

2.1.2 创建 venv

执行以下代码,会在 /venv 处创建一个 Python 3 的虚拟环境。

python3 -m venv /venv

2.1.3 将 venv 作为默认解释器

把以下代码追加到 ~/.bashrc 的末尾。

source /venv/bin/activate

下次登录将会生效。

2.2 安装

可参考 pip3 换源 令 pip 使用国内镜像。

pip install docker-compose

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK