Skip to content

Instantly share code, notes, and snippets.

@tobert
Last active August 29, 2015 14:06
Show Gist options
  • Save tobert/a48a622561ea482f6e52 to your computer and use it in GitHub Desktop.
Save tobert/a48a622561ea482f6e52 to your computer and use it in GitHub Desktop.

Running the Docker Image

docker pull tobert/dsc208
mkdir /srv/cassandra
ssh-keygen # hit enter a few times, accept all defaults
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
docker run -d -v /root:/root tobert/dsc208

# Cassandra is now running. Now you need to ssh into the container
# to get access to tools such as nodetool.

# find the Docker ID
docker ps
# copy either the first column, or the last one
docker inspect $ID

# -- or --
ps -ef |grep dropbear
# copy the IP address

ssh $IP_ADDRESS

Example

root@ptlab:~# docker run -d -v /root:/root tobert/dsc208
root@ptlab:~# docker ps
CONTAINER ID        IMAGE                  COMMAND                CREATED             STATUS              PORTS                                    NAMES
ec4a7ef04f88        tobert/dsc208:latest   /bin/cassandra-runne   3 minutes ago       Up 3 minutes        7000/tcp, 7199/tcp, 9042/tcp, 9160/tcp   grave_hypatia
root@ptlab:~# docker inspect ec4a7ef04f88 |grep IPAddress
        "IPAddress": "172.17.0.3",
root@ptlab:~# ssh 172.17.0.3

Stopping

# get the ID of the container
docker ps

# kill it
docker kill $ID

Example

root@ptlab:~# docker ps
CONTAINER ID        IMAGE                  COMMAND                CREATED             STATUS              PORTS                                    NAMES
ec4a7ef04f88        tobert/dsc208:latest   /bin/cassandra-runne   3 minutes ago       Up 3 minutes        7000/tcp, 7199/tcp, 9042/tcp, 9160/tcp   grave_hypatia
root@ptlab:~# docker kill ec4a7ef04f88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment