Thursday 8 November 2018

Why should i use docker? container?

Docker is operating-system-level virtualization also know as containers.

Why should i use docker?

Ans: It's gives you want you want ( literally ). It run all application as an instance.


How to use Docker? ( eg if you want to run httpd on docker)

1. Install Docker on linux or windows box ( Linux preferred )

2. docker pull httpd

3. docker run -p 80:80 -d -v /var/www/html:/usr/local/apache2/htdocs:Z httpd
    (This will mount your local /var/www/html to /usr/local/apache2/htdocs of docker instance)



Other useful commands :

 ls -l /var/lib/docker/
 ls -l /var/lib/docker/containerd/

docker pull centos
docker run -it -d centos
docker container ls
docker commit 4f0b435cdbd7 man-centos
docker kill container_id
docker rm  container_id
docker exec -it [container-id] bash
docker run -p 80:80 -d -v /var/www/html:/usr/local/apache2/htdocs:Z httpd   - :Z

docker run ubuntu:14.04 echo "hola"