Monday, September 30, 2024

Installing Docker on Ubuntu 24.04

I am going to do a simple install of Docker on Ubuntu 24.04

 

The official docker install guide for ubunt can be found at https://docs.docker.com/engine/installation/linux/ubuntu/#prerequisites

 


Installation

 

Update apt-get and install extra tools

 

  > sudo apt-get update
  > sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

 

 

Add the docker official GPG key

 

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

 

 

Add the docker repo

 

  > echo "deb [arch=$(dpkg --print-architecture) 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

 

 


Update again and install docker

 

  > sudo apt-get update
  > sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

 

 

 

That's it!  

Confirm its installed

 

  > sudo docker --version

 

 



Testing


Now test it real quick

 

  > sudo docker run hello-world

 

 

Worked!

 

Let me done something a little more interesting as a test.

 

  >  sudo docker run -p 8080:80 nginx

 

This should download the nginx docker image and runs it locally and connects its port 80 to local port 8080.

Then from another terminal run this

 

  >  curl localhost:8080

 


You should get back a web page. 


And there is the docker logs from the running docker nginx image.

Or you could open the URL directly

http://192.168.0.202:8080/   (replace with your IP address of course)


OK that is enough for this simple article. Docker is installed tested.

 


 

References

[1]       Install Docker on Ubuntu guide

https://docs.docker.com/engine/installation/linux/ubuntu/#prerequisites
Accessed 9/2024

 

 

 

 

1 comment: