Accessing the VM via Guacamole:
Docker Installation:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
curl -sSL https://get.docker.com | sudo sh
Installation Verification:
sudo usermod -aG docker <user> sudo reboot # Restart the VM to apply the changes.
sudo apt update sudo apt install bash-completion curl sudo mkdir /etc/bash_completion.d/ sudo curl -L https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh sudo curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
- Basic Commands:
docker info # Displays information about the Docker engine. docker ps # Displays running containers. docker ps -a # Displays all containers.
- Download and run an Nginx container:
docker pull nginx docker run --name "test_nginx" nginx
- To access Nginx, configure the port correctly:
docker stop test_nginx docker rm test_nginx docker run -p 8080:80 --name "test_nginx" nginx
- Launch a Funkwhale container:
docker run --name funky_container -p 80:80 funkwhale/all-in-one:1.0.1 docker rm -f funky_container # Remove the container after use.
- Create a network for Wordpress:
docker network create wordpress
- Download and run a MySQL container:
docker run --name mysql_container -e MYSQL_ROOT_PASSWORD=<password> -e MYSQL_DATABASE=<dbname> -e MYSQL_USER=<dbuser> -e MYSQL_PASSWORD=<dbpassword> -d mysql:5.7
- Download and run a Wordpress container:
docker run --name wordpress_container -p 8080:80 --network wordpress -e WORDPRESS_DB_HOST=mysql_container -e WORDPRESS_DB_USER=<dbuser> -e WORDPRESS_DB_PASSWORD=<dbpassword> -e WORDPRESS_DB_NAME=<dbname> -d wordpress
- Remove stopped containers:
docker rm $(docker ps -aq -f status=exited)
- Remove an image:
docker rmi <image_id>
- Decompose a Docker container:
docker export <container_name> -o container.tar tar -C container_decompressed -xvf container.tar
- Launch a Portainer instance:
docker volume create portainer_data docker run --detach --name portainer -p 9000:9000 -v portainer_data:/data -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce