docker run <SOME-CONAINER>
docker search <IDK, i.e. wpscan>
start ubuntu
docker run ubuntu:latest echo "Welcome to Ubuntu"
ubuntu w/ interactive bash shell
docker run --name samplecontainer -it ubuntu:latest /bin/bash
List running containers :
docker ps
docker ps -a ## for all, stopped/running/etc
Stop/remove a container:
docker kill d4
docker rm d4
# workflow:
docker run --name dummynginx -d nginx:alpine
docker ps (to identify it)
docker stop dummynginx
docker rm dummynginx
Stop/remove an image
docker images
docker rmi d4
- run alpine in bg
docker run --name pingcontainer -d alpine:latest ping 127.0.0.1 -c 50
Looking at the logs (stdout) of a containerdocker logs -f pingcontainer
docker run -d --name nginxalpine -p 7777:80 nginx:alpine
now you can access via curl localhost:7777
Accessing the container service using the container IP and container port
docker exec -it nginxalpine sh
ip addr
curl 172.17.0.2:80
Returns low-level information on Docker objects
docker inspect <container name>
docker inspect <image name>
docker inspect nginx:alpine
docker history jess/htop
Compose is a tool for defining and running multi-container Docker applications, i.e. wordpress.
cd /opt/wordpress
docker-compose up -d
docker volume ls
docker network ls
web interface for managing docker hosts and swarm clusters
docker run -d -p 9000:9000 --name portainer \
--restart always -v /var/run/docker.sock:/var/run/docker.sock \
-v /opt/portainer:/data portainer/portainer
Now you can access portianer at http://STUDENTVMIP:9000
List port forwarded for an image:
docker port d4
Run a container:
docker run -it <image name> <command>
MySQL for dev in a container:
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v PATH:/var/lib/mysql mysql
Mongo for dev in a container:
docker run -d -p 27017:27017 --name mongodb mongo -v PATH:/data/db