diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000000000000000000000000000000000..72e8ffc0db8aad71a934dd11e5968bd5109e54b4
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+*
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d6022a7d398140be9a394b9ce97586b13935ac8a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,53 @@
+~*
+*~
+*.sw[op]
+*.py[cod]
+.DS_Store
+__pycache__/
+.vagrant/
+vendor/
+Thumbs.db
+*.retry
+.svn/
+.sass-cache/
+*.log
+*.out
+*.so
+node_modules/
+.npm/
+nbproject/
+*.ipynb
+.idea/
+*.egg-info/
+*.[ao]
+.classpath
+.cache/
+bower_components/
+*.class
+*.[ewj]ar
+secring.*
+.*.kate-swp
+.swp.*
+.directory
+.Trash-*
+build/
+_build/
+dist/
+.tox/
+*.pdf
+*.exe
+*.dll
+*.gz
+*.tgz
+*.tar
+*.rar
+*.zip
+*.pid
+*.lock
+*.env
+.bundle/
+debian
+ubuntu
+centos
+fedora
+alpine
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..681d296a878bd848d43d8291a7c1fe37b113b3c5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+---
+language: c
+dist: trusty
+sudo: false
+group: beta
+services:
+  - docker
+
+script:
+  - make test clean
+
+notifications:
+  email: false
+  on_failure: never
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..9f6cd97ee8d6de522ec5a62c30752dac757a4a9f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,21 @@
+ARG image
+FROM ${image}
+RUN if command -v apt-get; \
+    then \
+        apt-get update && apt-get install -y sudo; \
+    elif command -v yum; \
+    then \
+        yum install -y sudo; \
+    elif command -v apk; \
+    then \
+        apk add --update --no-cache sudo; \
+    elif command -v dnf; \
+    then \
+        dnf install -y sudo; \
+    fi
+ARG userland
+ADD [ "https://www.shore.co.il/blog/static/runas-${userland}", "/entrypoint"]
+ENTRYPOINT [ "/bin/sh", "/entrypoint" ]
+VOLUME /volume
+WORKDIR /volume
+ENV HOME /volume
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8f9fac4592132f4a7cdc5482bfc7baef1ba9dd12
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Adar Nimrod
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..9fc05b3158141f7b502ad57481cf730fbe0826c3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+.PHONY: test clean
+
+test:
+	bats test.bats
+
+clean:
+	docker image ls --format '{{.ID}}' runas-* | xargs -r docker image rm
+	rm -f debian fedora ubuntu alpine
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..47e3d8e0dac14fc59702439e20be93995c272663
--- /dev/null
+++ b/README.md
@@ -0,0 +1,28 @@
+# Docker runas test
+
+[![Build Status](https://travis-ci.org/adarnimrod/docker-runas-test.svg?branch=master)](https://travis-ci.org/adarnimrod/docker-runas-test)
+
+> A test suite for the runas Docker entrypoint. See:
+> <https://www.shore.co.il/blog/docker_uid/> for more explanation.
+
+## Requirements
+
+- [Bats](https://github.com/sstephenson/bats)
+- [Docker](https://www.docker.com) 
+
+## Usage
+
+```
+bats test.bats
+```
+
+## License
+
+This software is licensed under the MIT license (see `LICENSE.txt`).
+
+## Author Information
+
+Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
+https://www.shore.co.il/). Patches are welcome via [`git send-email`](
+http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
+at: <https://www.shore.co.il/git/>.
diff --git a/test.bats b/test.bats
new file mode 100644
index 0000000000000000000000000000000000000000..fdd10b579981d5fd67cf0330a08f637bf0ce651e
--- /dev/null
+++ b/test.bats
@@ -0,0 +1,17 @@
+#!/usr/bin/env bats
+
+_test () {
+    name="${1:-$BATS_TEST_DESCRIPTION}"
+    tag="${2:-latest}"
+    userland="${3:-gnu}"
+    docker build -t "runas-$name" --build-arg "image=$name:$tag" --build-arg "userland=$userland" ./
+    docker run --rm -v "$BATS_TEST_DIRNAME:/volume" "runas-$name" touch "$name"
+    test "$(id -u)" = "$(stat -c '%u' $name)"
+    test "$(id -g)" = "$(stat -c '%g' $name)"
+}
+
+@test "ubuntu" { _test; }
+@test "debian" { _test debian stable-slim; }
+@test "centos" { _test; }
+@test "fedora" { _test; }
+@test "alpine" { _test alpine latest busybox; }