1

Caveat that docker is completely new to me and I may be making glaring errors in the configuration that I'm simply not aware about.

My goal is to have a droplet on digital ocean doing two things. Pulling the image from a repo when it is modified and running the container.

The container will need to run a react application. This should also pull from a repository on change.

I currently have a docker image for my react project. And the questions I'm trying to answer are:

  1. Docker image pull on droplet:

    • Pull an image from a repo on a regular schedule
    • Restart the image
  2. React application pull on droplet:

    • Pull a version from a repo on a regular schedule
    • Restart the application

It occurs to me that pulling the version from the repo could be achieved with a cron job. It's been a long time but I could probably figure that out.

I realise this question provides few details. I'm still trying to get my head around many concepts here and I find that a lot of the documentation doesn't quite provide the answers I need in whole, and if in part it's small parts strewn across many pages. Any help, or pointing in a direction is greatly appreciated.

TheMightyLlama
  • 1,243
  • 1
  • 19
  • 51

2 Answers2

0

You can use WatchTower

  • Pull an image from a repo on a regular schedule

  • Restart the image

Full documentation here : WatchTower - Go to the Argument section to view Scheduling arguments.

I don't know why you want to pull the project from repo while running the docker image but for this, you can use jenkins for CI/CD on the digital ocean server. You just need some basic tutorials to do this:

  • Pull a version from a repo on a regular schedule

  • Restart the application

Zain Ur Rehman
  • 287
  • 3
  • 14
0

I think first you need to clarify some basic concepts.

  • Image is like a template
  • Container is the instance of an image

The images can't be restarted because those are not instances of something while containers can be restarted because those are running a specific version of an image.

Also, I think you're implementing bad approach updating under a cron your environment because what would happen if you by accident push a wrong image? All the system will fail, so, IMHO, I strong recommend you don't do that, better yet, do it through a tool like Jenkins, Github Actions, Gitlab Pipelines, son on, and use better practices of CI/CD.

Jorge Alvarez
  • 293
  • 2
  • 4
  • 15