Site icon installvirtual

How to use docker..?

Basic docker commands

How to Use Docker

This is a third post in this series in which you will learn how to use docker, how to run docker container. You will get some new commands that will help in running docker containers.

 

There are five of the docker tutorial:

Part 1 : Installation and Configuration of Docker in Centos/Redhat & Fedora

Part 2 : Installation and Configuration of Docker in Ubuntu

Part 3 : Basic Docker Commands

Part 4 : How to run Container in Docker

Part 5 : How to take Backup & Restore of Docker Container

Docker

————————————————————————————————————————

In Simple words Docker is a Process based Virtualization Software. It uses process instead of any hypervisors.

————————————————————————————————————————

So now we will start using docker you can install docker on your laptop or your pc please don’t use critical system.

Run docker container

Firstly check the list of docker images

$ docker images

Now we will run docker container and then we have bash access to the container

$ docker run -i -t centos /bin/bash

To run docker container in background as daemon use following command

$ docker run -d centos /bin/bash

To get the list of running containers

$ docker ps

To attach the running container

$ docker attach (container id)

Note: You can find container id when you run docker ps command

To stop docker container by image name

$ docker stop (container id)

To expose a port on live docker container

$ docker run -p 8000:80 -i -t centos /bin/bash

With the help of these commands and this tutorial you can run docker containers..

 

If you have problem using this tutorial please feel free to comment below.

 

 

 

Exit mobile version