docker images
docker ps -a
docker ps -aq | xargs docker stop && docker ps -aq | xargs docker rm
docker build . -t <image_tag>
docker network create -d <network_type> --subnet x.x.x.x/mask --ip-range x.x.x.x/mask <network_name>
Example: docker network create -b bridge --subnet 192.168.10.0/28 --ip-range 192.168.10.1/29 net1
docker run [OPTIONS] <image_name> [COMMAND] [ARG...]
Where OPTIONS can be:
-i
- interactive, keep stdin open even if not attached-t
- allocate a pseudo tty-d
- detach, run dontainer in background and print container id-h <host_name>
- container host name string-p host_port:container_port
- publish container's ip to host; host will forward requests to the container on the specified port; can be used multiple times--network <network_name>
- specify a custom network to run this container in--name <custom_container_name>
- assign a name to this container--ip <set_ip_value>
- assign a fixed ip value to the docker containerExample:
docker run -d --network net1 -p 9000:9000 --name my_image -h my_image_host my_local_image
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' <container_name>
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container_name>