Push simple Node application to Docker hub
Dockerfile example https://github.com/alytvynov/docker-simple-node/blob/master/Dockerfile
# Start from a Node.js 10 (LTS) image
# Specify the directory inside the image in which all commands will run
# Copy package files and install dependencies
COPY package*.json ./
RUN npm install
RUN npm install --save express
# Copy all of the app files into the image
COPY . .
# The default command to run when starting the container
CMD [ "npm", "start" ]
To build image run the command
docker build -t simple-node .
Now if you run the command bellow you ll see your image
What is docker image registry ? This is the place where you can save your images and their version. Like GitHub, GitLab, Bitbucket, there are also different docker hubs.
Sure the most popular is Docker hub. But the most modern companies provides their own image registries.
To publish image to registry you should have credentials there. Than login throw the terminal. https://docs.docker.com/engine/reference/commandline/login/
So open your terminal enter
To publish the image we need to create a tag and than push it.
In the example bellow we ll push image to latest and 0.0.1.
docker tag simple-node lytvynov/simple-node
docker push lytvynov/simple-node#with version
docker tag simple-node lytvynov/simple-node:0.0.1
docker push lytvynov/simple-node:0.0.1
Than you ll see two versions in your hub account.
Thank you for your attention
Thank you for your attention. If you have any questions feel free to contact me. I‘ll be glad to help you.