〇Portainerの画面
○構築方法
1.以下のVagrantfileを使用して、Portainer/Docker/Docker Composeがインストールされた仮想マシン(Debian Stretch/9.4)を構築する事ができます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.4"
config.vm.hostname = "db94portainer"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db94portainer"
vbox.cpus = 4
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.108", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.108", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
locale-gen ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
# install docker-ce
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
apt-get update
apt-get -y install docker-ce
groupadd docker
adduser vagrant docker
systemctl enable docker
docker version
# install docker compose
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
mkdir -p /opt/portainer
docker swarm init --advertise-addr 192.168.1.108 | grep -e '--token' | sed -e 's/ //' - > /vagrant/joincmd.sh
docker service create \
--name portainer \
--publish 9000:9000 \
--replicas=1 \
--constraint 'node.role == manager' \
--mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
--mount type=bind,src=/opt/portainer,dst=/data \
portainer/portainer \
-H unix:///var/run/docker.sock
echo 'access to http://192.168.1.108:9000'
SHELL
end
2.ブラウザから192.168.1.108:9000にアクセスして、管理者情報を入力します。
○関連情報
・Portainerに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿