container cannot run by itself, it always needs an image.
create container registry in azure and copy login information
docker login user110acr.azurecr.io
# enter username and password
docker has three types of networks:
containers in the same network can connect to each other by specifying the container name. the default network does not have name resolution.
always create a custom network and configure IPs that make sense in the environment.
creates persistent storage at /var/lib/docker/volumes/. Root permissions are required to access this path.
# download inspect image
docker image pull ubuntu
docker image inspect ubuntu
# run container and detach (background) or -it (interactive)
docker container run -d
docker container -it
# --name sets the name of the container
# --hostname sets the hostname of the guest
docker container run -it --name ux --hostname ux-host ubuntu
# attach to a container with exec -it or attach
docker container exec -it ux /bin/bash
docker container attach ux
# install stuff in container and commit to new image
docker exec ux apt-get update && sudo apt-get install iputils-ping
docker container commit ux myux
# tag an image for upload and then push to azure registry
docker login user110acr.azurecr.io
docker image tag myuximage:latest user110acr.azurecr.io/myubuntu:latest
docker image push user110acr.azurecr.io/myubuntu
# build image from Dockerfile in current directory
docker build . -t myimage:latest