Skip to content

Instantly share code, notes, and snippets.

@wwerner
Last active December 22, 2023 10:48
Show Gist options
  • Save wwerner/05a8e627e8f3ba18300db745511d3bcb to your computer and use it in GitHub Desktop.
Save wwerner/05a8e627e8f3ba18300db745511d3bcb to your computer and use it in GitHub Desktop.
Enable heroku ps:exec in docker containers
FROM openjdk:8-jdk-alpine
VOLUME /tmp
# see https://devcenter.heroku.com/articles/exec#enabling-docker-support
RUN apk add --no-cache curl bash openssh python
ADD src/main/docker/heroku-exec.sh /app/.profile.d/heroku-exec.sh
RUN chmod a+x /app/.profile.d/heroku-exec.sh
ADD src/main/docker/sh-wrapper.sh /bin/sh-wrapper.sh
RUN chmod a+x /bin/sh-wrapper.sh
RUN rm /bin/sh && ln -s /bin/sh-wrapper.sh /bin/sh
#!/usr/bin/env bash
# see https://devcenter.heroku.com/articles/exec#enabling-docker-support
[ -z "$SSH_CLIENT" ] && source <(curl --fail --retry 3 -sSL "$HEROKU_EXEC_URL")
#! /bin/bash
/bin/bash "$@"
@jimkring
Copy link

jimkring commented Mar 2, 2022

Thanks everyone! @MrFishFinger's solution for alpine worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment