Skip to content

Instantly share code, notes, and snippets.

@lucabrunox
Created April 13, 2016 22:08
Show Gist options
  • Save lucabrunox/69f13ac0077194c03094e8bc8c3d6805 to your computer and use it in GitHub Desktop.
Save lucabrunox/69f13ac0077194c03094e8bc8c3d6805 to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
dockerTools.buildImage {
name = "redis";
runAsRoot = ''
#!${stdenv.shell}
${dockerTools.shadowSetup}
groupadd -r redis
useradd -r -g redis -d /data -M redis
mkdir /data
chown redis:redis /data
cp /etc/pam.d/other /etc/pam.d/su
'';
config = {
Cmd = [ "${shadow.su}/bin/su" "redis" "-c" "${redis}/bin/redis-server" ];
ExposedPorts = {
"6379/tcp" = {};
};
WorkingDir = "/data";
Volumes = {
"/data" = {};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment