Docker Setup Ubuntu

sudo apt install docker.io
sudo apt install docker
sudo systemctl start docker.service
sudo systemctl enable docker.service

Access container

docker exec -it container_name/container_name /bin/bash
sudo docker exec -it container_id /bin/bash

Install web service to Docker

 sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
“deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo docker run -dit –name linux-guru -p 8080:80 -v /home/user/website/:/usr/local/apache2/htdocs/ httpd:2.4

Information :-

sudo docker compose pull (Pull Image)
sudo docker compose up -d (Container Up)
sudo docker-compose ps (Container Status)
sudo docker rm container_name (Remove Container)

Stop all running containers: docker stop $(docker ps -a -q)
Delete all stopped containers: docker rm $(docker ps -a -q)