Tuesday, January 15, 2019

Docker essential commands

View running instances:
$ docker ps

View all instances including stopped one:
$ docker ps -a

View all downloaded images in the system:
$ docker images

Instantiate and run an image:
$ docker run -it --name x1 ubuntu bash
Here, i = interactive
t = terminal

$ docker run -d -p x1

(location to docker file)
$ docker build -t x1

Remove an instance:
$ docker rm
$ docker rmi

Start / Stop instance:
$ docker stop x1
$ docker start x1

Map a local drive to a docker instance:
$ docker rm -d -p -v /home/kd/myCode:/var/www/html

No comments:

Post a Comment