本文介绍在Linux Mint 19系统中安装Docker CE(Docker Community Edition)和安装Docker Compose的方法。指定版本可以参考在Ubuntu 18.04系统中安装指定docker版本的简单方法。
一、安装依赖项包 在安装docker软件包前先安装其依赖项包: sudo apt-get update sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
二、添加Docker的官方GPG密钥 导入用于签署Docker包的Docker GPG密钥: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
三、将Docker存储库添加到Linux Mint 19系统中 将Docker上游存储库添加到Linux Mint 19中,以便安装最新的稳定版Docker: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable" 上面的命令将向其他存储库文件添加一个新行: $ cat /etc/apt/sources.list.d/additional-repositories.list deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
四、在Linux Mint 19中安装Docker和Docker Compose 其它Linux发行版安装方法参考在Fedora 29/Fedora 28上安装Docker Compose的方法。 更新apt包索引: $ sudo apt-get update Hit:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease Hit:3 http://archive.canonical.com/ubuntu bionic InRelease Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease Ign:5 http://packages.linuxmint.com tessa InRelease Hit:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Get:7 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB] Hit:8 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Hit:9 http://packages.linuxmint.com tessa Release Get:11 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [3,695 B] Fetched 68.1 kB in 2s (33.9 kB/s) Reading package lists… Done 然后安装最新版本的Docker CE和Docker Compose: sudo apt-get -y install docker-ce docker-compose 已创建docker组但未添加任何用户,将普通用户添加到组中以作为非特权用户运行docker命令: sudo usermod -aG docker $USER 注销并重新登录,以便重新评估你的组成员身份。 运行测试docker容器: $ docker run --rm -it --name test alpine:latest /bin/sh Unable to find image 'alpine:latest' locally latest: Pulling from library/alpine cd784148e348: Pull complete Digest: sha256: 46e71df1e5191ab8b8034c5189e325258ec44ea Status: Downloaded newer image for alpine:latest / # cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.8.2 PRETTY_NAME="Alpine Linux v3.8" HOME_URL="http://alpinelinux.org" BUG_REPORT_URL="http://bugs.alpinelinux.org" / # exit 到这里,已经成功在Linux Mint中安装Docker和Docker Compose了。
相关主题 |