The docker images can all be run/built similar to the following.
Setup the variables per image.
GitHub Example
registry="docker.io/"
image_path="myuser/"
image_name="myimage"
tag_name="latest"
image="${registry}${image_path}${image_name}:${tag_name}"
GitLab Example
registry="mygitlab.example.com:4567/"
image_path="mygroup/myproject/"
image_name="myimage"
tag_name="latest"
image="${registry}${image_path}${image_name}:${tag_name}"
To run an image manually from the command line:
docker run -it --rm --name testing ${image} /bin/sh
To run an image and mount your current working directry into the image for use (at /mnt)
docker run -it --rm --name testing -v ${PWD}:/mnt ${image} /bin/sh
- Build image using a Dockerfile (in the current directory)
docker build -t ${image_name}:${tag_name} .
- Run a test container from the built image to verify
docker run -it --rm --name testing ${image_name}:${tag_name} /bin/sh
- Tag the local image in preparation for a remote registry push
docker tag ${image_name}:${tag_name} ${image}
- Login to the remote registry (prompted for registry username/password)
docker login https://${registry}
- Push to the remote registry
docker push ${image}
- Optional: Additional tag latest and push
docker tag ${image_name}:${tag_name} ${registry}${image_path}${image_name}:latest
docker push ${registry}${image_path}${image_name}:latest