Creating a Docker Image and Uploading it to DockerHub

I created a nginx web-server container winth docker by using a simple dockerfile.

FROM nginx
EXPOSE 80
COPY _site/ /usr/share/nginx/html

Then, create an image via:

docker build . -t imagename:imagetag

Optional: Running The Image

docker run [--name containername] [-p outport:inport] imagename:imagetag

Pushing The Image

First, tag the image. Registry host is optional if you are using DockerHub. username/repositoryname suffices.

docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]

Login to your docker registry. Again, server is optinal for dockerhub.

docker login [SERVER]
# Then Enter Your Credentials

Then, push

docker push NAME[:TAG]

Reference

[1] https://stackoverflow.com/questions/28349392/how-to-push-a-docker-image-to-a-private-repository

[2] https://rickyhan.com/jekyll/update/2017/09/05/deploy-static-website-on-kubernetes.html