Skip to content

Instantly share code, notes, and snippets.

@mrflip
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrflip/4baaa6f57d6628e74691 to your computer and use it in GitHub Desktop.
Save mrflip/4baaa6f57d6628e74691 to your computer and use it in GitHub Desktop.
Single-node Hadoop cluster

In the below, we'll use the following to track the version of the image you'll use

dv=1

Launching image

docker run -it --name hadoop_local -u chimpy -w /home/chimpy -e HOME=/home/chimpy -e TERM="$TERM" "bd4c/hadoop_local:v1.$dv" /bin/bash -l

This will drop you into a shell, no ssh'ing needed (or possible).

In this command, hadoop_local is the name of the docker instance; bd4c/hadoop_local:v1.$dv (eg bd4c/hadoop_local:v1.1) is the image that's run; the rest of the goop is to make the shell environment be the chimpy user

Re-connecting to an image

docker start -ai hadoop_local

where hadoop_local is the name of the image you used with the docker run ... command.

Committing a change

Whenever you like, you can commit any changes to the image and push them to the server

## see what's changed
docker diff hadoop_local
## Increment the version number, and commit it to a new tag
docker commit -m "demo change" hadoop_local bd4c/hadoop_local:v1.$((++dv))
## Push that new image
docker push bd4c/hadoop_local:v1.$dv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment