gandra404
gandra404

Reputation: 6081

How to run docker image with specific version and port forwarding

I want to run official Cassandra version 2.1.9 inside docker. Also, I want to have following ports mapping:

7000:7000  
7001:7001  
7199:7199  
9042:9042  
9160:9160  

What command do I have to run in order to achieve this goal?

Upvotes: 11

Views: 29533

Answers (1)

Elton Stoneman
Elton Stoneman

Reputation: 19184

The official Cassandra image doesn't have 2.1.9. The closest is 2.1.15 which shouldn't have any compatibility issues. The easiest way to run it is:

docker run -d -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 cassandra:2.1.15

-p publishes a ports from the image to a specific port number on the host. The Cassandra Dockerfile exposes exactly those ports. You'd probably want to give the container a --name as well.

If you really want 2.1.9 you'll have to hunt for a non-official image or build your own.

Upvotes: 17

Related Questions