如何在 Alpine Linux 上安装 docker 和 docker-compose
在这篇文章中,我们将展示如何在 Alpine Linux 上安装 docker-compose(和 docker 后端)。
步骤 1:启用 apk 社区仓库
以 root 身份编辑仓库配置,使用
edit_apk_repositories.sh
vi /etc/apk/repositories它应该看起来像这样(确切的 URL 将根据你选择的镜像而变化)
apk_repositories_example.txt
#/media/cdrom/apks
http://ftp.halifax.rwth-aachen.de/alpine/v3.13/main
#http://ftp.halifax.rwth-aachen.de/alpine/v3.13/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/main
#http://ftp.halifax.rwth-aachen.de/alpine/edge/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/testing现在找到**以 /community 结尾且不以 /edge/community 结尾的行。**通常,这是文件中的第二行:
apk_repositories_uncomment.sh
#http://ftp.halifax.rwth-aachen.de/alpine/v3.13/community使用箭头键导航到此行,按 Insert 键以激活编辑。
然后删除行首的 #。结果文件应该看起来像这样:
apk_repositories_result.txt
#/media/cdrom/apks
http://ftp.halifax.rwth-aachen.de/alpine/v3.13/main
http://ftp.halifax.rwth-aachen.de/alpine/v3.13/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/main
#http://ftp.halifax.rwth-aachen.de/alpine/edge/community
#http://ftp.halifax.rwth-aachen.de/alpine/edge/testing现在按 Esc 键,输入 :wq 并按回车保存文件并退出编辑器。
步骤 2:安装 docker 和 docker-compose
现在我们将使用以下命令获取包列表
apk_update.sh
apk update之后,我们可以使用以下命令安装 docker 和 docker-compose
install_docker_alpine.sh
apk add docker docker-compose步骤 3:启用 docker 守护进程自动启动并启动 docker 守护进程
使用以下命令启用启动时自动启动
enable_docker_autostart.sh
rc-update add docker default然后使用以下命令启动 docker
start_docker_daemon.sh
/etc/init.d/docker startCheck out similar posts by category:
Alpine Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow