How to use Docker and migrate your existing Apps? We will cover all the cool advantages of containerization, and how to easily migrate and manage your existing services and apps into Docker Containers on your Linux Server!
We will use the free and open-source software Docker.
Project Homepage: https://www.docker.com/ Documentation: https://docs.docker.com/
Video: https://youtu.be/y0GGQ2F2tvs
- Linux Server running Ubuntu 20.04 LTS or newer
You can still install Docker on a Linux Server that is not running Ubuntu, however, this may require different commands!
You can still install Docker on a Linux Server that is not running Ubuntu, however, this may require different commands!
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
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 $(lsb_release -cs) stable"
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
Download the latest version (in this case it is 1.25.5, this may change whenever you read this tutorial!)
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo docker-compose --version
sudo usermod -aG docker $USER
docker run hello-world
To get new applications, just visit the official Docker Hub. Because most vendors and communities maintain their own images, you will find Images for many applications there.
Run a simple NGINX webserver.
docker run -p 80:80 -d nginx
docker run -p 80:80 -v nginx_data:/var/www/html -d nginx
Migrate a NGINX webserver to Docker.
sudo systemctl stop nginx
sudo systemctl disable nginx
docker run -p 80:80 -v /var/www/html:/var/www/html -d nginx
Migrate a MySQL Server to Docker.
sudo systemctl stop mysql-server
sudo systemctl disable mysql-server
docker run -v /var/lib/mysql:/var/lib/mysql -d mysql
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce