Skip to content

Commit

Permalink
Change containerDir path as /var/run is a special directory
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnils committed Jan 13, 2018
1 parent 5efbcf0 commit 0e95554
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,21 @@ type CreateContainerOpts struct {

func (d *docker) ContainerCreate(opts CreateContainerOpts) (err error) {
// Make sure directories are available for the new instance container
containerDir := "/var/run/pwd"
containerDir := "/opt/pwd"
containerCertDir := fmt.Sprintf("%s/certs", containerDir)

env := []string{fmt.Sprintf("SESSION_ID=%s", opts.SessionId)}

// Write certs to container cert dir
if len(opts.ServerCert) > 0 {
env = append(env, `DOCKER_TLSCERT=\/var\/run\/pwd\/certs\/cert.pem`)
env = append(env, `DOCKER_TLSCERT=\/opt\/pwd\/certs\/cert.pem`)
}
if len(opts.ServerKey) > 0 {
env = append(env, `DOCKER_TLSKEY=\/var\/run\/pwd\/certs\/key.pem`)
env = append(env, `DOCKER_TLSKEY=\/opt\/pwd\/certs\/key.pem`)
}
if len(opts.CACert) > 0 {
// if ca cert is specified, verify that clients that connects present a certificate signed by the CA
env = append(env, `DOCKER_TLSCACERT=\/var\/run\/pwd\/certs\/ca.pem`)
env = append(env, `DOCKER_TLSCACERT=\/opt\/pwd\/certs\/ca.pem`)
}
if len(opts.ServerCert) > 0 || len(opts.ServerKey) > 0 || len(opts.CACert) > 0 {
// if any of the certs is specified, enable TLS
Expand Down
26 changes: 14 additions & 12 deletions dockerfiles/dind/Dockerfile.dind-ee
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
ARG VERSION=franela/docker:17.06.2-dind-ubuntu
ARG VERSION=franela/docker:18.01-dind-ubuntu
FROM ${VERSION}

RUN apt-get update \
&& apt-get install -y git tmux apache2-utils vim curl jq bash-completion \
&& apt-get install -y git tmux apache2-utils vim curl jq bash-completion tree zip \
&& rm -rf /var/lib/apt/lists/*


# Add bash completion and set bash as default shell
#RUN mkdir /etc/bash_completion.d \
# && curl https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker -o /etc/bash_completion.d/docker \
# && sed -i "s/ash/bash/" /etc/passwd
# Add kubectl client
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.6/bin/linux/amd64/kubectl \
&& chmod +x ./kubectl \
&& mv ./kubectl /usr/local/bin/kubectl


# Install a nice vimrc file and prompt (by soulshake)
COPY ["docker-prompt", "sudo", "ucp.sh", "/usr/local/bin/"]
COPY [".vimrc",".profile", ".inputrc", ".gitconfig", "workshop.lic", "./root/"]
COPY ["docker-prompt", "sudo", "ucp-beta.sh", "/usr/local/bin/"]
COPY [".vimrc",".profile", ".inputrc", ".gitconfig", "workshop_beta.lic", "./root/"]
COPY ["motd", "/etc/motd"]
COPY ["ee/daemon.json", "/etc/docker/"]
COPY ["ee/cert.pem", "/var/run/pwd/certs/"]
COPY ["ee/key.pem", "/var/run/pwd/certs/"]
COPY ["ee/cert.pem", "/opt/pwd/certs/"]
COPY ["ee/key.pem", "/opt/pwd/certs/"]
COPY ["ee/config.json", "/root/.docker/"]

# Move to our home
WORKDIR /root

# Setup certs and uploads folders
RUN mkdir -p /var/run/pwd/certs && mkdir -p /var/run/pwd/uploads
RUN mkdir -p /opt/pwd/certs /opt/pwd/uploads /var/lib/kubelet

# Remove IPv6 alias for localhost and start docker in the background ...
CMD cat /etc/hosts >/etc/hosts.bak && \
Expand All @@ -35,6 +35,8 @@ CMD cat /etc/hosts >/etc/hosts.bak && \
sed -i "s/\DOCKER_TLSCERT/$DOCKER_TLSCERT/" /etc/docker/daemon.json && \
sed -i "s/\DOCKER_TLSKEY/$DOCKER_TLSKEY/" /etc/docker/daemon.json && \
mount -t securityfs none /sys/kernel/security && \
mount --make-shared -t tmpfs tmpfs /run && \
mount --make-shared -t tmpfs tmpfs /var/lib/kubelet && \
dockerd > /docker.log 2>&1 & \
while true ; do script -q -c "/bin/bash -l" /dev/null ; done
# ... and then put a shell in the foreground, restarting it if it exits
4 changes: 2 additions & 2 deletions dockerfiles/dind/ee/daemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"insecure-registries": ["127.0.0.1"],
"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2376"],
"tls": true,
"tlscert": "/var/run/pwd/certs/cert.pem",
"tlskey": "/var/run/pwd/certs/key.pem"
"tlscert": "/opt/pwd/certs/cert.pem",
"tlskey": "/opt/pwd/certs/key.pem"
}
1 change: 0 additions & 1 deletion www/assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@
};

$scope.openEditor = function(instance) {
console.log(instance);
var w = window.screen.availWidth * 45 / 100;
var h = window.screen.availHeight * 45 / 100;
$window.open('/sessions/' + instance.session_id + '/instances/'+instance.name+'/editor', 'editor',
Expand Down

0 comments on commit 0e95554

Please sign in to comment.