Friday 21 November 2014

simple Dockerfile example1

1. cat Dockerfile

FROM cassandra
ADD start.sh /start.sh # to copy the file into
CMD ["bash", "./start.sh"]
EXPOSE 9160
EXPOSE 9042
EXPOSE 7000
EXPOSE 44478
EXPOSE 7199


2. cat start.sh
#!/bin/bash
service cassandra start
while true; do sleep 60; done  # Not sure any other best way for now

3. 
docker build -t="runcassandra" .     # this will create an image named runcassandra

4.
docker run -d -P --name cass1 runcassandra

NOTE: The cassandra will be up and will listen to rest of the port. But key thing is when you use EXPOSE, these ports get use for container to container communication ***ONLY***,  as per my current understanding, and this is what I found from the documentation too.


No comments:

Post a Comment