ubuntu 安装docker portainer

2022-03-16 Views335字2 min read

安装curl

 sudo apt install curl

安装docker

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

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================

安装portainer

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart=always --name prtainer portainer/portainer

安装docker-compose Ubuntu下可以通过apt install docker-compose 不过版本比较老

bash 脚本或者 Dockerfile需要从github下载最新版的文件。

https://api.github.com/repos/{owner}/{repo}/releases/latest

# 获取最新版本号
tag_name=`curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name|cut -f4 -d "\""`

# 下载最新版地址:
sudo curl -L "https://github.com/docker/compose/releases/download/$tag_name/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

#下载完成后,将可执行权限应用于文件:
sudo chmod +x /usr/local/bin/docker-compose

#验证安装是否成功,请运行以下命令,该命令将打印Compose版本:
docker-compose --version

#要卸载Docker Compose,只需输入以下命令即可删除二进制文件:
sudo rm /usr/local/bin/docker-compose

获取github上最新版shell

EOF