Hyper Open Edge Cloud

How To Install Docker And Portainer On Rapid.Space

How To Install Docker And Portainer On Rapid.Space
  • Last Update:2021-03-03
  • Version:001
  • Language:en

How To Install Docker And Portainer On Rapid.Space

 

Agenda

  1. Install and start docker
  2. Download and run Portainer 2.0
  3. Enable IPv6 support in Docker daemon
  4. Verify listening port
  5. Access Portainer.io interface

 

Access VPS via SSH

πŸ”— How To Access A VPS Via Ssh On Rapid.Space (Presentation)

Install and start docker

su -
apt install docker.io
systemctl start docker

You can check if docker is installed and activated by

root@rapidspace:~# docker --version
Docker version 18.09.1, build 4c52b90 # output
root@rapidspace:~# systemctl is-active docker
active #ouput

Download and run Portainer 2.0

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

You will get the similar output: 

root@rapidspace:~# docker pull portainer/portainer-ce
Using default tag: latest #output
latest: Pulling from portainer/portainer-ce #output
Digest: sha256:21713e42233ee953b4cd4e6e8b1e4b6c43ebe2ca1c2dc762824a1866fdb91d3e #output
Status: Image is up to date for portainer/portainer-ce:latest #output
root@rapidspace:~# docker run --restart=always --name=portainer -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce
6d804c1f73a281122188f63798a14e3990b2edd7a61451f7f20b8d3a5a133289 #output

You can also check your container: portainer by

docker stats

The sample output: 

6d804c1f73a2        portainer           0.00%               11.26MiB / 236.2GiB   0.00%               3.5kB / 946B        0B / 403kB          21

 

Enable IPv6 support in Docker daemon

Edit the Docker configuration file

 

Edit /etc/docker/daemon.json

"fixed-cidr-v6" should be a subnet of your IPv6 address: 

{
  "ipv6": true,
  "fixed-cidr-v6": "2001:67c:1254:64:f8de:1111::1/96"
}

Save the file

Before you can use IPv6 in Docker containers or swarm services, you need to enable IPv6 support in the Docker daemon. Afterward, you can choose to use either IPv4 or IPv6 (or both) with any container, service, or network.

Note: IPv6 networking is only supported on Docker daemons running on Linux hosts.

Edit /etc/docker/daemon.json, set the ipv6 key to true and the fixed-cidr-v6 key to your IPv6 subnet. In this example we are setting it to 2001:67c:1254:64:f8de:1111::1/96.

"fixed-cidr-v6" should be a subnet of your IPv6 address (the one you use to ssh at the beginning). For example, if the IPv6 address is 2001:67c:1254:64:f8de::1, you are supposed to set it as 2001:67c:1254:64:f8de:xxxx::1/96

Enable IPv6 support in Docker daemon

Restart the Docker configuration file

systemctl restart docker

You can now create networks with the --ipv6 flag and assign containers IPv6 addresses using the --ip6 flag.

And if you check ip -6 a, you will have docker0 with "fixed-cidr-v6" which is a subnet of ens4. (If you lose ens4, try ifdown ens4 ; ifup ens4 to bring it back)

root@rapidspace:~# ip -6 a
......
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2001:67c:1254:64:f8de::1/80 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::fc84:a8ff:fe02:87f1/64 scope link 
       valid_lft forever preferred_lft forever
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP 
    inet6 2001:67c:1254:64:f8de:1111:0:1/96 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::1/64 scope link 
       valid_lft forever preferred_lft forever
    inet6 fe80::42:a3ff:fed7:fa9a/64 scope link 
       valid_lft forever preferred_lft forever
......

Verify listening port

root@rapidspace:~# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      745/sshd            
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      715/cupsd           
tcp6       0      0 :::9000                 :::*                    LISTEN      24577/docker-proxy  
tcp6       0      0 :::22                   :::*                    LISTEN      745/sshd            
tcp6       0      0 ::1:631                 :::*                    LISTEN      715/cupsd       

9000 port is listening on your IPv6 localhost. 

root@rapidspace:~# wget http://localhost:9000
--2021-01-20 17:25:13--  http://localhost:9000/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:9000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23167 (23K) [text/html]
Saving to: ‘index.html’
index.html                                100%[=====================================================================================>]  22.62K  --.-KB/s    in 0s      
  2021-01-20 17:25:13 (338 MB/s) - ‘index.html’ saved [23167/23167]

Access Portainer.io interface

πŸ”— http://[IPv6_ADDRESS]:9000

When you get there, create a username and password to enjoy portainer.