Running A Dedicated Docker Host in VirtualBox
#VirtualBox #Docker #VirtualMachine
Full steps can be found at https://i12bretro.github.io/tutorials/0598.html
--------------------------------------------------------------------
Creating the Host VM
--------------------------------------------------------------------
01. Open a web browser and download the Turnkey Linux Core .ova https://www.turnkeylinux.org/core
02. Launch VirtualBox
03. Select File ≫ Import Appliance...
04. Click the Browse icon ≫ Navigate to and select the downloaded .ova file
05. Click Next and then Import
06. Make sure the Turnkey Core VM is selected and click Start ≫ Normal
07. Once the VM boots, enter a new root password
08. Select Skip on the TurnKey Backup and Migration screen
09. Select Skip on the System Notifications screen
10. Select Install on the Security Updates screen
11. Note the URLs and IP address for the VM ≫ Press Enter to finish the installation
--------------------------------------------------------------------
Installing Updates and Docker
--------------------------------------------------------------------
01. Press Enter to select Advanced Menu
02. Arrow down and select Quit ≫ Press Enter ≫ Select Yes to confirm ≫ Press Enter
03. Run the following commands to install updates
# update software repositories
apt update
# install available software updates
apt upgrade -y
# clean apt cache
apt clean
# reboot the container
reboot now
04. Log back into the container
05. Run the following commands to install Docker
# install prerequisitesapt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | apt-key add -
# add docker apt repository
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# update software repositories
apt update
# install docker
apt install docker-ce docker-compose containerd.io -y
06. Welcome to your Docker host
07. At this point you can use docker run and docker-compose to run containers from the terminal
Documentation: https://docs.docker.com/engine/reference/commandline/docker/
--------------------------------------------------------------------
Optionally Install Portainer (Recommended)
--------------------------------------------------------------------
Portainer is an open source tool for managing container-based software applications in Kubernetes, Docker, Docker Swarm, Azure ACI and edge environments.
It can be used to set up and manage environments, deploy applications, monitor app performance and triage problems. It is used by software engineers, devops and infrastructure teams all over the world to simplify processes, reduce risk and streamline operations.
01. Run the following commands to start a Portainer container in Docker
# create a working directory for portainer
mkdir ~/docker/portainer_data -p
# run the portainer container
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v ~/docker/portainer_data:/data portainer/portainer-ce
# output the ip docker host address
ip addr
02. Open a web browser and navigate to http://DNSorIP:9000
03. Set an administrator username and password ≫ Click Create user
04. Click the Docker - Manage the local Docker environment option ≫ Click Connect
05. Welcome to Portainer, Docker container management from a web browser
Documentation: https://www.portainer.io/installation/
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro