Docker and some docker commands

Coming back after a few days I totally forgot where I was in the processes and what have I learned so I started by opening the command and started looking at the command to run and the I remember that the first that we run is the docker version to see if the docker is installed properly or not and when I run it I got this message back

  • docker version

docker1

Now here is an error mentioned here which I have no clue how to solve so I will start by ripping that apart.

“error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.”

Th restart didn’t work so I am going to reset it to factory setting

Ok I may have missed something but the command works now so this is what I see

docker2

 

Now I am going to

  • docker run hello-world

The client is going to check if the image exists locally or not and it does so what it will do it’s going to fetch the image form the daemon via the API calls and its going to check the local store and its not there  so its going to go to docker hub and in the public registry. And now when I run it again I will see the hello from the docker message from the container. So it was running showed the message and then existed.

Now to show the container who have been running and existed I need to run a different command. Now when I run this command I will be able to see this

  • docker ps -a

docker3

 

To see the image that is already placed I just go to

  • docker images

And I see this

docker4

 

To remove a docker image us this command sometimes you have to force the delete so for that I am going to use this command

  • docker rmi -f image_id

The terminology goes like this the

Images are stopped containers but the containers are running images.

 

So here I can run the try from the code that I ave from the plural site and for that I can run this command

  • docker run -d –name web -p 90:8080 nigelpoulton/pluralsight-docker-ci

Now in this command as you can see it’s going to make a web container the internal port is outer port to access docker host on port 90 but inside the container, its port is 8080. Once I finish running that command the image is pulled to my local directory.

Now I can check if the container is running or now by running

  • docker ps

In that you can see that the container is running now you have to open the browser and browse to localhost:90 and then you can see that you will be able to access it. Now if you stop the container and browse again you will not be able to access it

 

 

The container lifecycle is not that complex. It include only three states.

docker5

Other common dockers commands are

  • Docker start
  • Docker stop
  • Docker rm conatiner