Sunday, October 6, 2019

Install Docker in Kali Linux

References:
https://www.runoob.com/docker/docker-tutorial.html


Installation:
#curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
#echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' > /etc/apt/sources.list.d/docker.list
#apt-get update
#apt-get remove docker docker-engine docker.io
#apt-get install docker-ce


Testing:
#docker run hello-world


Start and Enable Docker:
#systemctl enable docker
#systemctl start docker


Search and Pull a docker:
#docker search apache
#docker pull httpd


Show installed images:
#docker images


Run a docker: (P.S.: "-d" represents running in the background, and "-P" represents Transport-Layer Port Mapping)
#docker run -d -P httpd
And the mapped Transport-Layer port can be specified:
#docker run -d -p 8443:443 httpd
The command above maps the docker's TCP443 to the host machine's TCP8443.


Run a docker in a shell:
#docker run -t -i IMAGE_NAME /bin/bash
Such as:
#docker run -t -i metasploitframework/metasploit-framework /bin/bash


Enter a running docker with a shell:
#docker exec -t -i CONTAINER_ID /bin/bash
Such as:
#docker exec -t -i b936b0afeb23 /bin/bash


Show what dockers are running:
#docker ps


Show Transport-Layer ports related to the docker:
#docker port CONTAINER_ID
Such as:
#docker port b936b0afeb23


Show logs generated by the docker:
#docker logs -f CONTAINER_ID
Such as:
#docker logs -f b936b0afeb23


Check the performance of the docker:
#docker top CONTAINER_ID
Such as:
#docker top b936b0afeb23


Show the details of the docker:
#docker inspect CONTAINER_ID
Such as:
#docker inspect b936b0afeb23


Stop a docker
docker stop CONTAINER_ID
Such as:
#docker stop b936b0afeb23


Delete a docker:
#docker rmi -f httpd

No comments:

Post a Comment