Skip to content

Commit

Permalink
Merge branch 'master' into bind
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlach committed Aug 8, 2019
2 parents 4fe047d + a394d40 commit 293359e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Expand Up @@ -13,7 +13,7 @@ USER root
COPY --from=su-exec /usr/local/bin/su-exec /su-exec

# Docker
ARG DOCKER_COMPOSE_VERSION=1.24.0
ARG DOCKER_COMPOSE_VERSION=1.24.1
RUN apt-get update && \
apt-get install -y \
apt-transport-https ca-certificates curl gnupg-agent software-properties-common figlet && \
Expand All @@ -28,6 +28,8 @@ RUN apt-get update && \
chmod +x /usr/local/bin/docker-compose && \
curl -L "https://raw.githubusercontent.com/docker/compose/${DOCKER_COMPOSE_VERSION}/contrib/completion/bash/docker-compose" -o /etc/bash_completion.d/docker-compose && \
curl -L "https://raw.githubusercontent.com/nicferrier/docker-bash-completion/master/docker-complete" -o /etc/bash_completion.d/docker && \
curl -sf https://raw.githubusercontent.com/lukaszlach/clip/master/docker-clip -o /usr/libexec/docker/cli-plugins/docker-clip && \
chmod +x /usr/libexec/docker/cli-plugins/docker-clip && \
apt-get install -y \
bash bash-completion \
curl wget \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
@@ -1,6 +1,9 @@
build:
docker build -t code-editor .

list:
docker images | grep code-editor

run:
rm -rf test/ && mkdir test/
docker run --rm -it --name code-editor -v /var/run/docker.sock:/var/run/docker.sock -e EDITOR_UID=$$(id -u) -e EDITOR_GID=$$(id -g) -e EDITOR_CLONE="https://github.com/lukaszlach/orca.git" -e EDITOR_EXTENSIONS="peterjausovec.vscode-docker" -e EDITOR_BANNER=code-container -e EDITOR_LOCALHOST_ALIASES="local;localtest.me" -e EDITOR_PASSWORD=docker -e EDITOR_PORT=8443 -p 8443:8443 -v $$(pwd)/test:/files --hostname workshop --pid host code-editor
Expand Down
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -13,6 +13,8 @@ Code Container is based on the [Code Server](https://github.com/cdr/code-server)
* automatic installation of editor extensions
* additional tools like `make`, `strace`, `envsubst` or `tldr`
* Docker client and docker-compose with bash completion
* Docker client experimental features enabled
* Docker client plugins support with [Docker Client Plugins Manager](https://github.com/lukaszlach/clip) pre-installed
* Kubernetes client
* possibility to run in `pid` and `net` host modes, useful when doing Docker workshops
* detection of Docker Desktop and setting `localhost` accordingly
Expand Down Expand Up @@ -72,6 +74,10 @@ docker run -d --pid host --name code-container --hostname code-container \
docker build -t lukaszlach/code-container .
```

## Contributors

[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/0)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/0)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/1)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/1)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/2)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/2)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/3)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/3)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/4)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/4)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/5)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/5)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/6)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/6)[![](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/images/7)](https://sourcerer.io/fame/lukaszlach/lukaszlach/code-container/links/7)

## License

MIT License
Expand Down
5 changes: 2 additions & 3 deletions entrypoint.sh
Expand Up @@ -2,7 +2,6 @@
editor_exec() {
/su-exec "$EDITOR_USER_NAME" "$@"
}
set -e
if [ ! -e /var/run/docker.sock ]; then
echo "Error: /var/run/docker.sock not mounted"
exit 1
Expand All @@ -14,8 +13,7 @@ EDITOR_GID="${EDITOR_GID:-10001}"
EDITOR_USER="${EDITOR_UID}:${EDITOR_GID}"

groupadd -g "$EDITOR_GID" "$EDITOR_GROUP_NAME" || \
groupmod -n "$EDITOR_GROUP_NAME" $(getent group "$EDITOR_GID" | cut -d: -f1) || \
true
groupmod -n "$EDITOR_GROUP_NAME" $(getent group "$EDITOR_GID" | cut -d: -f1)
useradd -m -u "$EDITOR_UID" -g "$EDITOR_GID" -G 0 -s /bin/bash "$EDITOR_USER_NAME"

if mountpoint /files >/dev/null 2>&1; then
Expand All @@ -34,6 +32,7 @@ fi
# https://github.com/cdr/code-server/issues/436
socat TCP-LISTEN:2376,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock &>/dev/null &
export DOCKER_HOST=tcp://127.0.0.1:2376
export DOCKER_CLI_EXPERIMENTAL=enabled

# Profile
touch /tmp/.versions
Expand Down

0 comments on commit 293359e

Please sign in to comment.