1

I had to perform these steps to deploy my Nodejs/Angular site to AWS via DockerCloud

  • Write Dockerfile
  • Build Docker Images base on my Dockerfiles
  • Push those images to Docker Hub
  • Create Node Cluster on DockerCloud Account
  • Write Docker stack file on DockerCloud
  • Run the stack on DockerCloud
  • See the instance running in AWS, and can see my site

If we require a small thing changes that require a pull from my project repo. BUT we already deployed our dockers as you may know.

What is the best way pull those changes into the Docker containers that already deployed ?

I hope we don’t have to :

  • Rebuild our Docker Images
  • Re-push those images to Docker Hub
  • Re-create our Node Cluster on DockerCloud
  • Re-write our docker stack file on DockerCloud
  • Re-run the stack on DockerCloud

I was thinking

SSH into a VM that has the Docker running

git pull
npm start 

Am I on the right track?

code-8
  • 54,650
  • 106
  • 352
  • 604

2 Answers2

1

You can use docker service update --image https://docs.docker.com/engine/reference/commandline/service_update/#options I have not experience with AWS but I think you can build and update automatically.

Kilian
  • 1,753
  • 13
  • 21
  • What is the fatest way to do this ? Is there a way to hook up our docker to auto pull ? What tools should I looking for ? What technology should I learn ? CI ? Jenkins ? – code-8 Dec 07 '17 at 02:53
1

If you want to treat a Docker container as a VM, you totally can, however, I would strongly caution against this. Anything in a container is ephemeral...if you make changes to files in it and the container goes down, it will not come back up with the changes.

That said, if you have access to the server you can exec into the container and execute whatever commands you want. Usually helpful for dev, but applicable to any container.

This command will start an interactive bash session inside your desired container. See the docs for more info.

docker exec -it <container_name> bash

Best practice would probably be to update the docker image and redeploy it.

HammerMeetNail
  • 350
  • 1
  • 12
  • What is the fatest way to do this ? Is there a way to hook up our docker to auto pull ? What tools should I looking for ? What technology should I learn ? CI ? Jenkins ? – code-8 Dec 07 '17 at 02:53
  • Great questions! CI/CD is invaluable in today's dev environments. As our responsibilities increase and we need to interact with more systems, the the chance for mistake/error increases. That's where Jenkins shines. Think of it as a literal robotic butler that will run any command you normally would against any systems you interact with. You can set up git hooks to automatically trigger a build and deploy to dev or prod servers using the latest branch. Check [this post](https://www.stratoscale.com/blog/devops/practical-devops-use-case-github-jenkins-docker/) out for more info. – HammerMeetNail Dec 07 '17 at 03:10
  • Thanks, you saved me so much hours from learning the wrong tools. I'll start looking more into Jenkins, and will start with post you suggested for sure. :D – code-8 Dec 07 '17 at 03:13