Goal:
We are creating dev environments for developers in GCP cloud.
Every developer would have a dedicated Linux VM in GCP for day to day development tasks & testing
Linux VM is a dev environment(with multiple tools installed for source code checkout etc...). Docker daemon is another tool, needed, for day to day tasks.
So, Linux VM should have docker daemon(installed) to launch docker containers(for testing).
Can we install docker daemon on Linux VM? if yes, please provide steps..
CodePudding user response:
You can refer the document provided by digital ocean.
I was able to successfully setup docker using the above and once docker is installed, make sure to add your user into docker group. Please refer this link for post installation tasks.
CodePudding user response:
When I build VMs for developers that require Docker, I use a startup script so that Docker is installed when the VM is created. This script can also be used in a terminal window to manually install Docker.
This script is for Debian/Ubuntu systems.
One variable is required. $USER needs to be added to the docker group so that users can run containers without sudo permissions. This script runs commands with sudo
which is not required as a startup script but is required for a normal user.
#!/bin/bash -v
sudo apt update
sudo apt upgrade -y
sudo apt install apt-transport-https -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce -y
sudo usermod -aG docker ${USER}
echo "User ${USER} added to docker group. Re-login to assume docker group membership."