Doker build
docker build . -t <tag_name>
Docker run
docker run -itd --privileged -v <host_dir>:<container_dir> -p <host_port>:<container_port> --name <container_name> <image_tag>
docker run -itd --privileged -v /home/vagrant/workspace/develop/ansible/Develop_on_ubuntu/ansible:/ansible -p 2223:22 --name dev dev
Container stop remove
docker stop $(docker ps -q)
docker rm -f <container_name>
docker rm $(docker ps -q -a)
docker rmi $(docker images -q)
Docker exec
docker exec -it <container_name> bash
Options
- -u ‘username’
- -d ‘background’
- -e ‘env’
- —privileged
- -w ‘workdir’
Create Network
docker network create <network_name>
docker network create --driver=bridge --subnet=172.30.0.0/24 dev
Volumes
Remove Volumes
docker volume rm <volume_name>
Get IP from container
Clean UP
Imagge
container