Posted under » Ubuntu » Linux » System Admin on 27 Apr 2024
Docker to me is like VM. Where you are running something else that your current OS does not support. Docker uses less memory than VM but one VM can host all containers. I think it is great if you want to try something and then trash it if you don't like it.
Install according to your specs and it has changed a lot in just months.
# Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update
Now we install docker proper
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
At this stage you don't need sudo.
Docker containers are built from Docker images so a container is like an instance of an image.
If the image does not exist, by default Docker will pull these images from Docker Hub. Let's test if we can pull an image.
$ service docker start $ docker run hello-world
In some cases you have to pull the images
$ docker pull httpd
To look at your local images
$ docker images
To see running containers
$ docker ps $ docker ps -a
To start a stopped container, use docker start, followed by the container ID. To stop a running container, use docker stop, followed by the container ID or namei. Once you’ve decided you no longer need a container anymore, remove it with the docker rm.
$ docker start 1c08a7a0d0e4 $ docker stop ubuntu $ docker rm ubuntu
If you want to try Moodle using docker »
Maybe this is all too hard to remember for a beginner like me so I recommend that you docker this app called Portainer »