apt-get update && apt-get upgrade -y
Next as I am on a Debian system and currenly running as root. Install sudo below.
apt-get install sudo
Next add the current user e.g myuser to the sudo group
usermod -aG sudo myuser
Next logout and back in
logout
sudo whoami
Should return root
Next install curl
sudo apt-get install curl
Next install docker
curl -fsSL https://get.docker.com -o get-docker.sh
Next execute the downloaded script
sh get-docker.sh
Official Document for install (convenience script)
Test Docker by grabbing Hello world image
docker run hello-world
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the “hello-world” image from the Docker Hub. (Assuming it was not already locally available.)
3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal
sudo usedmod -aG docker myuser
next logout and back in and you can run docker command with out sudo
logout
Testing with out sudo – ps comamnd lists containers running
docker ps
docker volume create portainer_data
Next install Portainer as the volume has been created.
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.5
Next run docker ps and you will see Portainer listed in the running containers .
Docs: https://docs.portainer.io/start/install-ce/server/docker/linux
Next Visit the Web UI
https://ipaddress:9443
You will see SSL warning just continue as it is self signed.
Next follow on screen instructions and you are done.
# List all containers
docker ps -a
# Remove the hello-world container (replace with actual container ID or name)
docker rm <container_id_or_name>
# List all images
docker images
# Remove the hello-world image (replace with actual image ID or name)
docker rmi hello-world
Warning if using ubuntu.
Do not install Docker via Snap if done by mistake use below
# Just incase you accidentally installed snap version of docker:
sudo snap remove docker
# For other versions of docker:
sudo apt remove docker docker-engine docker.io containerd runc
Comments