Skip to content

Instantly share code, notes, and snippets.

@dergachev
Last active January 17, 2016 11:33
Show Gist options
  • Save dergachev/1b0e7a1818cad30813fa to your computer and use it in GitHub Desktop.
Save dergachev/1b0e7a1818cad30813fa to your computer and use it in GitHub Desktop.
#!/bin/bash
# This wrapper script overcomes the problem of docker-produced files in a shared-volume not being
# readable or writeable by the non-root user in the docker host.
# NB: you still need to separately ensure that the newly created files have the
# correct group permission. This can be achieved as follows:
## chmod g+s /srv/octopress-master/{public,config,_deploy,source/_posts}
# Ensures all newly created files will be 775, instead of the debian default of 755.
umask 002
eval "$@"
ADD docker-umask-wrapper.sh /bin/docker-umask-wrapper.sh
RUN chmod u+x /bin/docker-umask-wrapper.sh
docker-run:
mkdir -p posts config public deploy
chmod g+s posts config public deploy
docker run -t -i \
-v `pwd`/posts:/srv/octopress-master/source/_posts \
-v `pwd`/config:/srv/octopress-master/config \
-v `pwd`/public:/srv/octopress-master/public \
-v `pwd`/deploy:/srv/octopress-master/_deploy \
-v `dirname $(SSH_AUTH_SOCK)`:`dirname $(SSH_AUTH_SOCK)` -e SSH_AUTH_SOCK=$(SSH_AUTH_SOCK) \
-p 4000:4000 \
wujtruj/octopress \
docker-umask-wrapper.sh $(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment