1

I'm using elastic-beanstalk to deploy multiple docker containers. I have travisCI configured to watch for changes to the master branch of my code repository, rebuild the docker images, push the new images to Docker hub, and then redeploy with elastic-beanstalk. The issue is that the elastic-beanstalk instance continues to show an older version of the image after the redeployment.

My .travis.yml file:

sudo: required
services:
  - docker

cache: false

before_install:
  - docker build -t [image-tag-1] -f ./client/dev.Dockerfile ./client

script:
  - node ./testTest.js

after_success:
  - docker build -t [image-tag-1]-client ./client
  - docker build -t [image-tag-2]-nginx ./nginx
  - docker build -t [image-tag-3] ./server
  # Log into the docker CLI
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
  # Take those images and push them to docker hub
  - docker push [image-tag-1]
  - docker push [image-tag-2]
  - docker push [image-tag-3]

deploy:
  provider: elasticbeanstalk
  region: us-west-2
  app: xxxx-v7
  env: xxxxx-env
  bucket_name: elasticbeanstalk-us-west-2-xxxx
  bucket_path: docker-xxxx
  on:
    branch: master
  access_key_id:
    secure: $AWS_ACCESS_KEY
  secret_access_key:
    secure: $AWS_SECRET_KEY

After pushing changes to the master branch, travis successfully rebuilds and pushes the images, and elastic-beanstalk successfully redeploys. But the content of the elastic-beanstalk site shows that the old docker image is still being used. How can I get elastic-beanstalk to actually pull the new images during the redeployment?

E Jacobs
  • 31
  • 2
  • Possible duplicate of [AWS Beanstalk docker image automatic update doesn't work](https://stackoverflow.com/questions/34241428/aws-beanstalk-docker-image-automatic-update-doesnt-work) – LinPy Sep 20 '19 at 05:52
  • @LinPy The answers there did not resolve my issue – E Jacobs Sep 21 '19 at 01:28

1 Answers1

0

Try specifying the label variable in the deploy settings. The label is a unique identifier for a deployment version. If you continue using the same label, the same version will be deployed to the beanstalk even if you build and push the new version.

Further reading:

Pulasthi
  • 145
  • 5