Using Docker Alpine images

This faq answers common questions related to using Alpine on Wercker. Most issues are caused by the minimal nature of the images, which is why most issues are also applicable to other minimal containers, such as BusyBox.

I receive a “context canceled” error when using an Alpine container

This error occurs during the setup environment step, and is caused by the fact that we use /bin/bash to run the steps. Alpine doesn’t contain the bash shell, so it fails.

Wercker doesn’t require bash. You can instead use sh. You’re able to override the cmd that Wercker uses by specifying the cmd property in the box section:

box:
    id: alpine
    cmd: /bin/sh

I receive the “Unable to sync environment” when using docker-push on Alpine

After receiving this warning the container stops. Before running the Docker deploy step, we first synchronize the environment variables from within the container to the Wercker executable. We do this by invoking env --null inside the container and parsing the output. Alpine does not support the --null flag, and so it crashes.

To prevent this error from happening, you can add the disable-sync flag:

box:
    id: alpine
    cmd: /bin/sh
deploy:
    steps:
        - internal/docker-push:
            disable-sync: true

This does mean that you’re unable to use any environment variables defined within the container. Any environment variables defined at the start of execution, or on Wercker web, will work.