Running Docker command for the first time!

I’ve recently started learning Docker. I realise you need to understand Docker before getting into Kubernetes. I must tell you that learning Kubernetes is the aim.

Let me share my first experience spinning up a fresh new Docker container.


I ran the typical docker run <image-name>.

Yes! The first container spined up and exited instantly.

Out of curiosity, I spined the second container, Ubuntu. Exited in the same way as the first one.

Now I spined it again, but this time in interactive mode using the code:

docker run -it Ubuntu Bash

I was able to activate the container’s interactive mode using the code provided above. I could experiment with the ls command in the same way that I would in any other Linux environment.

Out of curiosity, I did — docker run -it -p 8000:8000 Ubuntu Bash

I used to believe that I could access a Docker container in the browser by utilising the IP address 172.17.0.2 and the additional port 8000. I also tried using this. http://localhost:8000/

Now I know. Searching the internet, I found this from stack overflow —  “That’s correct: you can’t access the docker inspect IP address on a Windows host. You also can’t access it from a MacOS host, if your Docker is more explicitly inside a virtual machine (using Docker Toolbox or a tool like Minikube for your Docker environment), or if you’re calling from a different host from the container. This IP address is almost never useful and you shouldn’t need to look it up at all.”

Lesson learnt!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *