Setup + add swap and instal Docker & docker-compose
- check if your instance already has a swap file or partition:
sudo swapon --show- Create 1GB swap file called
/swapfile. You can adjust the size of the file by changing the number after-l.
sudo fallocate -l 1G /swapfilesudo chmod 600 /swapfilesudo mkswap /swapfile- Enable the swap file
sudo swapon /swapfile- Add an entry to the
/etc/fstabfile to ensure that the swap file is automatically enabled after every reboot
/swapfile swap swap defaults 0 0- Verify the swap file
sudo swapon --show
free -h- Update your existing packages
sudo apt update- Install a prerequisite packages which let apt utilize HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common- Add GPG key for the official Docker repo to the Ubuntu system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -- Add the Docker repo to APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"- Update the database with the Docker packages from the added repo:
sudo apt update- install Docker and Docker compose +
Docker CE command line interface+containerd
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin- Test verify the docker setup:
sudo docker --version
docker compose version
sudo docker run hello-world
sudo docker images
sudo docker ps -a- To avoid using sudo for docker activities, add your username to the Docker Group:
sudo usermod -aG docker {your_username}sudo apt install -y python3-pip python3-venv python3-dev python3-pandas git curl