Hex Cannot Be Found on Dockerized Phoenix App when running on Drone

So I currently have a setup wherein I deploy my dockerized Phoenix application to run tests on a self hosted Drone server. Currently the issue arises that no matter what Dockerfile I use(currently alpine-elixir-phoenix or a base elixir image with the following) which installs hex/rebar like below:

# Install Hex+Rebar
    RUN mix local.hex --force && \
    mix local.rebar --force

I receive the error upon booting in Drone,

  • Get version of the docker base image used to build an image
  • Tomcat deployment using Docker and Kubernetes
  • How to add couchdb server into docker creation file
  • unable to find the /etc/default/docker with latest docker 17.03.0-ce
  • Docker: data volume container is not instantiated with `docker create` command
  • How to remove docker support from an ASP.NET Core project?
  • Could not find Hex, which is needed to build dependency :phoenix

    I have found that by using an older version of alpine-elixir-phoenix:2.0 this issue does not come up which leads me to believe it may be something to do with hex/elixir having updated since then? Additionally if I run the commands to install hex and rebar within the container in Drone once it is instantiated there is no issue. I ran a whoami on the instantiated Drone container and the user is root if that makes a difference. Additionally if I run the container locally and run mix hex.info, it correctly states that hex is installed, however the issue is that on the Drone instantiated container this fails.

    Example .drone.yml:

        image: bitwalker/alpine-elixir-phoenix
                - cd api
                - apk update
                - apk add postgresql-client
                - MIX_ENV=test mix local.hex --force
                - MIX_ENV=test mix local.rebar --force
                - MIX_ENV=test mix deps.get
                - MIX_ENV=test mix ecto.create
                - MIX_ENV=test mix ecto.migrate
                - mix test

    Example Docker File used(bitwalker/alpine-elixir-phoenix) – https://github.com/bitwalker/alpine-elixir-phoenix/blob/master/Dockerfile

    where the same installation of local.hex and local.rebar occurs in the Dockerfile on lines 29 && 30. However upon instantiation of the container it is not found and therefore must be run again in the CMDs.

    Furthermore I encountered this problem again but with make and g++ not installing on alpine. I may be doing something incorrect but I cannot see where.

    testbuild_env Dockerfile

    FROM bitwalker/alpine-erlang:19.2.1b
    ENV HOME=/opt/app/ TERM=xterm
    # Install Elixir and basic build dependencies
    RUN \
    echo "@edge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
    apk update && \
    apk --no-cache --update add \
      git make g++ curl \
      elixir@edge=1.4.2-r0 && \
    rm -rf /var/cache/apk/*
    # Install Hex+Rebar
    RUN mix local.hex --force && \
    mix local.rebar --force
    ENV DOCKER_BUCKET test.docker.com
    ENV DOCKER_VERSION 17.05.0-ce-rc1
    ENV DOCKER_SHA256 4561742c2174c01ffd0679621b66d29f8a504240d79aa714f6c58348979d02c6
    RUN set -x \
    && curl -fSL "https://${DOCKER_BUCKET}/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz" -o docker.tgz \
    && echo "${DOCKER_SHA256} *docker.tgz" | sha256sum -c - \
    && tar -xzvf docker.tgz \
    && mv docker/* /usr/local/bin/ \
    && rmdir docker \
    && rm docker.tgz \
    && docker -v
    COPY docker-entrypoint.sh /usr/local/bin/
    ENTRYPOINT ["docker-entrypoint.sh"]
    CMD ["sh"]

    with the following .drone.yml

        image: test_buildenv
          - cd api
          - apk add make
          - apk add g++
          - MIX_ENV=test mix local.hex --force
          - MIX_ENV=test mix local.rebar --force
          - docker login --username USERNAME --password PASSWORD
          - mix docker.build # creates a release file after running a dockerfile.build image
          - mix docker.release # creates a minimalist image to run the release file that was just created
          - mix docker.publish # pushes newly created image to dokcerh
           - /var/run/docker.sock:/var/run/docker.sock

  • Contents in the container's bind-mounted dir keep unchanged after mounting/umounting removable drive from the host
  • can't restart docker after resetting the docker socker using docker -H tcp://
  • How can I create a docker volume container in specific directory?
  • Docker max depth exceeded
  • Docker: google/docker-registry container usage
  • Keep Docker running when shell script exits
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.