Issue
I want to implement CI/CD for my application, so far I have managed to build and upload my image on docker hub with GitHub actions. Now I need a way to pull that image on my VPS and run the docker image. I do not know how to achieve that, I tried multiple youtube videos but none show that. Could someone point me to the right direction?
Solution
Usually flow after image exists in Dockerhub is:
- you use the docker login command to log in to the user which has permissions to pull the image
- You can either pre pull the image using the docker pull command or you can straight on just use the docker run command and it will pull the image if not existing and run it.
For an example with Nginx, the image resides in Dockerhub and with help of official docs you can see
docker run --name mynginx1 -p 80:80 -d nginx
the command which will pull the Nginx image (latest in this case) and run the container with the name of mynigninx1 and expose the port on host 80 and map it to port 80 inside the container.
Answered By - matic1123 Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.