Need help in migrating to 2.0



I’m using CircleCI 1.0 to build a Docker image. I’m having trouble migrating my 1.0 workflow to 2.0. Actually I don’t even know if this is possible in 2.0.

I have the following build config:

  • all it’s doing is build a docker image and push it to ECR
  • tag based, using regex to match valid semver tags
  • using AWS ECR to pull and push a build cache image, as well as push the final image

I’m confused about how would this map to 2.0? Do I still need to push and pull the build cache image, or I can use the caching layers of 2.0 now?

This is my 1.0 config:

    - docker
    version: 2.7.12
    AWS_DEFAULT_REGION: us-east-1
    image_repo: abc
    image_root: docker/app

      - skip

    - virtualenv venv
    - . venv/bin/activate
    - pip install fabric semantic_version awscli boto3 docker-squash 'docker < 3' --disable-pip-version-check

    - "rsync -a --exclude='.git' --exclude='*.pyc' --exclude=.idea --exclude=circle.yml --exclude=db --exclude=docker --exclude=docs --exclude=node_modules --exclude=venv ../../ apptmp/":
        pwd: $image_root
    - "echo $CIRCLE_TAG > VERSION":
        pwd: $image_root

    - "$(aws ecr get-login)"

    - docker pull $image_user/$image_repo:build_cache; exit 0

    - "docker build --rm=false -t $image_user/$image_repo:build_cache .":
        pwd: $image_root

    - docker push $image_user/$image_repo:build_cache

    - exit 0

    tag: /[0-9]+(\.[0-9]+)*/
      - docker tag $image_user/$image_repo:build_cache $image_user/$image_repo:$CIRCLE_TAG
      - docker tag $image_user/$image_repo:build_cache $image_user/$image_repo:latest

      - docker push $image_user/$image_repo:$CIRCLE_TAG
      - docker push $image_user/$image_repo:latest

      - aws ecr batch-delete-image --repository-name $image_repo --image-ids "$(aws ecr list-images --repository-name $image_repo --filter tagStatus=UNTAGGED --query 'imageIds[*]')" || true

How can I migrate this to 2.0? I’m trying to mix it with but that’s even more confusing with the many Ubuntu XXL things. What is that for?


Yes, if you are a free-tier customer, no if you are a paid customer. For the latter, there is a native layer cache solution that you can request from customer support (see the docs).

To start with though, I would suggest you create a simple config.yml for 2.0 without layer caching, and just get it working to start with. Choose a suitable base image for Docker building (docker:17.05.0-ce-git is what I use) and give it a whirl. If you get stuck, show us what you have, and someone might be able to make suggestions.

That’s at the same level as build, and all of these are just labels for build jobs. You can call them what you like, and in the example you link to, there are several.


Thanks a lot! What about the setup_remote_docker, do I need it? The Ubuntu build image doesn’t have that line, while the official circleci-demo-docker does have it:


If you are doing manual Docker or Compose stuff, you can. See the docs for the purpose of it. If you don’t use it, the Docker command will be run locally. Try it with and without if you like, and consider whether the isolation it provides is useful to you.


If you’re on the free tier, I wrote up some Docker layer caching strategies linked from here.


Yes, free tier. Thanks for you blog post, I’ll go through it soon!


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.