A Dockerimage for building Cloud9 Instances for diffrent Projects
A simple blank cloud9 Container definition
it offers a VOLUME /workspace
docker run -v $PWD/workspace:/workspace cloud9
A Cloud9 instance with latest version from https://github.com/c9/core
The goal is to provide the lightest possible image.
Latest is build on node:slim. Other tags exist ready for some programming language (alpine, golang, golang-alpine, cordova-android).
Docker hub: https://registry.hub.docker.com/u/dockerimages/cloud9/
docker run -d -v $(pwd):/workspace -p 8181:8181 dockerimages/cloud9 --auth username:password
You can also use any starting option describe in : https://github.com/c9/core
docker run -d -v $(pwd):/workspace -v /home/user/c9.settings:/root/.c9/user.settings -p 8181:8181 sapk/cloud9
Where /home/user/c9.settings is the user.settings file on your file system
If you want to only expose cloud9 localy use -p 127.0.0.1:8181:8181 instead of -p 8181:8181. Otherwise it will be accesible to any equipement that can acces to your PC through the network.
You need to set auth because if not set the server will only listen to inner-container localhost host and wouldn't be available to the host.
**Image ID** | **Contents** | **Definition** |
---|---|---|
Ubuntu 14.04.5 with common tools such as Git, Node.js, OpenJDK, Apache Ant, Apache Maven, Nginx, MySQL, PostgreSQL, Ruby, Apache HTTP Server, and PHP. |
||
The contents of the |
||
The contents of the |
||
The contents of the |
||
The contents of the |
||
The contents of the |
||
cloud9/ws-nodejs (this sample) |
The contents of the |
|
The contents of the |
||
The contents of the |
||
The contents of the |
||
The contents of the |
||
The contents of the |
This sample shows you how to connect an Cloud9 SSH development environment to a running Docker container. This enables you to use the Cloud9 IDE to work with code and files inside of a Docker container and to run commands on that container.
Build a Dockerimage for The Workspace used for the cloud9 instance
# Build a Docker image based on the cloud9/ws-nodejs Docker image.
FROM cloud9/ws-nodejs
# Enable the Docker container to communicate with The Host by installing SSH.
RUN apt-get update && apt-get install -y openssh-server
# Ensure that Node.js is installed.
RUN apt-get install -y nodejs && ln -s /usr/bin/nodejs /usr/bin/node
# Disable password authentication by turning off the
# Pluggable Authentication Module (PAM).
RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
# Add the public key to the Docker container.
# This assumes a file named authorized_keys containing the
# SSH public key already exists in the same
# directory as the Dockerfile.
RUN mkdir -p /home/ubuntu/.ssh
ADD ./authorized_keys /home/ubuntu/.ssh/authorized_keys
RUN chown -R ubuntu /home/ubuntu/.ssh /home/ubuntu/.ssh/authorized_keys && \
chmod 700 /home/ubuntu/.ssh && \
chmod 600 /home/ubuntu/.ssh/authorized_keys
# Start SSH in the Docker container.
CMD /usr/sbin/sshd -D
# Update the password to a random one for the user ubuntu.
RUN echo "ubuntu:$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" | chpasswd
sudo docker run -d -it --expose 9090 -p 0.0.0.0:9090:22 --name cloud9 cloud9-image:latest