Deployed Cassandra in Docker, cannot connect with docker-cqlsh - docker

as per instruction in Cassandra quick start page, but I'm stuck at opening the interactive mode and its throwing the below error
docker run --rm -it --network cassandra nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.5'
error:
Traceback (most recent call last):
File "/usr/local/bin/cqlsh", line 2816, in <module>
main(*read_options(sys.argv[1:], os.environ))
File "/usr/local/bin/cqlsh", line 2707, in read_options
options.cqlversion, cqlvertup = full_cql_version(options.cqlversion)
File "/usr/local/bin/cqlsh", line 540, in full_cql_version
vertuple = tuple(map(int, ver_parts[0].split('.')) + [ver_parts[1]])
ValueError: invalid literal for int() with base 10: "'3"
we are just started learn cassandra, but we are struggling the early stages itself.

Assuming you are following this guide Apache Cassandra on Docker, After going through step 2 and running a container with Cassandra image like this:
docker network create cassandra
docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra
Instead of following step 5 as you are doing, you could just access the container in which your cassandra image is running using:
docker exec -it cassandra /bin/sh
Then go into interactive mode by typing
cqlsh
Hope this helps

The stacktrace you posted seems to indicate that the script is not able to parse the CQL version.
Please check that you're not using special quotation marks when you specify cqlversion.
Which operating system are you using and which version? I've come across reports in the past that some versions of Linux have a Python version that doesn't seem to work with cqlsh. Cheers!

Related

Start InfluxDB v2 in a docker container with a conf-file on Windows 10

I'm new to docker and also influx so I guess this question is in general a trivial one.
Because there don't exist an influxdb v2 for Windows yet I'm using the turnaround via docker with the official image quay.io/influxdb/influxdb:v2.0.3
On this installation guide it is explained how to start influxdb with an additional conf-file on Windows 10, but with another docker image and following command:
docker run -p 8086:8086 -v C:/ProgramData/InfluxDB:/var/lib/influxdb influxdb -config /var/lib/influxdb/influxdb.conf
I thought it's simple to adapt this guide and only replace the image.
According to my understanding I would have to use the following command to start my container, if my conf-file lies in C:/ProgrammData/InfluxDB
docker run --name influxv2 -p 8086:8086 -v C:/ProgrammData/InfluxDB:/var/lib/influxdb quay.io/influxdb/influxdb:v2.0.3 -config /var/lib/influxdb/influxdb.conf
With this command I always get the error
Error: unknown shorthand flag: 'c' in -config
Unfortunately I don't now how to fix the command and hope for a simple solution. Thank's a lot.

docker: quickstart cloudera hue configuration issue

I am using Docker toolbox, the image is: cloudera/quickstart.
Due to my computer, the docker run on 4GB memory and 2 cpu.
when i create new container the hue and hive works well, but when i use the container again (after exit) i get many problems in the hue therefore the hive is not working.
for example one of the errors:
the errors
the code i use to create new container:
docker run --hostname=quickstart.cloudera --privileged=true -t -i --publish-all=true -p 8888:8888 -p 80:80 --name cloudera-test cloudera/quickstart /usr/bin/docker-quickstart
so this is a problem of porting or hardware or something else?
i think i got the answer,
because my computer have 8 GiB memmory, when i use the command
docker start [container name]
it takes time to all the services to startup
we can see the status of all the services with the command
service --status-all
the location of all the services is: /etc/init.d/
so i suggest not to try get in the hue immediately after the container is startup.
if still there is problems try to check whice service is not OK.
for the HBase services we need to shut down them in this order:
1) service hbase-thrift stop
2) service hbase-regionserver stop
3) service hbase-master stop
and to start from bottom to up (3, 2, 1)
for more details you can read here

Alpine 3.6 Docker container error on stop (exit code 137)

Container running on Ubuntu 16.04
Below how I do (Random name sad_wiles created):
docker run -it -d alpine /bin/ash
docker run -it -d alpine /bin/sh
docker run -ti -d alpine
docker start sad_wiles running fine and I can enter & exit sh
However, docker stop sad_wiles giving exit code 137. Below is the log:
2017-11-25T23:22:25.301992880+08:00 container kill 61ea1f10c98e2462f496f9048dcc6b45e536d3f7ba14747f7f22b96afb2db60d (image=alpine, name=sad_wiles, signal=15)
2017-11-25T23:22:35.302560688+08:00 container kill 61ea1f10c98e2462f496f9048dcc6b45e536d3f7ba14747f7f22b96afb2db60d (image=alpine, name=sad_wiles, signal=9)
2017-11-25T23:22:35.328791538+08:00 container die 61ea1f10c98e2462f496f9048dcc6b45e536d3f7ba14747f7f22b96afb2db60d (exitCode=137, image=alpine, name=sad_wiles)
2017-11-25T23:22:35.547890765+08:00 network disconnect 3b36d7a71af5a43f0ee3cb95c159514a6d5a02d0d5d8cf903f51d619d6973b35 (container=61ea1f10c98e2462f496f9048dcc6b45e536d3f7ba14747f7f22b96afb2db60d, name=bridge, type=bridge)
2017-11-25T23:22:35.647073922+08:00 container stop 61ea1f10c98e2462f496f9048dcc6b45e536d3f7ba14747f7f22b96afb2db60d (image=alpine, name=sad_wiles)
This is not an error as mentioned in the comment by #yament You'll see this exit code when you do a docker stop and the initial graceful stop fails and docker has to do a sigkill. As mentioned here, it's a linux standard: 128 + 9 = 137 (9 coming from SIGKILL).
You can increase your memory limit in Docker App > Preferences > Advanced on Mac os. As changing this mem_limit=384m to 512m works. Here is additional resunce will help you, Exit Status
If you are curious about how sad_wiles name appeared as your container name, that has been a Docker feature from early days. If you do not specify a name for your Docker container using --name tag with your Docker run command, Docker will create a name for the container based on an open source list of scientist and hackers. You can get its source code from here.
The signal code issue may be due to the memory limit is low for Docker. A github issue was also opened on this. Refer it from here. Try changing the memory allocation for Docker as the comments for the attached github issue recommend.

client (browser, jdbc driver) hangs when trying to connect with docker instance

Summary
Client (browser,jdbc drive) hangs connecting to docker.
Context
I've been playing with docker and found an oddity: stuff running on my host OS (browser, jdbc driver) "hangs" trying to connect to docker.
I've concluded the issue lies with 'docker' and 'my setup' versus the images themselves, due to the fact that the problem appears:
with both Tomcat official images as well as with Microsoft's new Sql Server image
after I've successfully run docker once
Usecase
Boot my laptop (ubuntu 14.04)
Start up docker (see Appendix )
Connect with browser http://localhost:8888/.
Result: Success
Shut down docker instance: 'ctrl-c'
Start up docker again (Repeat step 2)
Try to connect with browser
Result: Browser hangs/spins for 20 minutes, than says "aborted"
Notes
Docker starts without error in both steps
After shutdown (step 4), "netstat -aon |grep 8888" shows nothing. So no 'rogue process' is listening on port 888
Because browser "hangs", rather than says "connection refused", I concluded Docker listens on the port, but doesn't do anything else.
Version Info
Ubuntu 14.04
Docker version 1.9.1, build a34a1d5
Appendix A: Docker file and commands
Dockerfile
Dockerfile: FROM tomcat:8.5.8-jre8-alpine
Commands
Create Image:
$ docker build -t mytomcat_858 .
Start:
$ docker run -it --rm -p 8888:8080 mytomcat_858
What command are you executing to start Docker the second time? docker start mytomcat_858? If it starts correctly the second time, can you do docker attach mytomcat_858 and view possible Tomcat errors?
I found, if not the root cause, at least workaround: restarting the docker daemon cleared up all the networking issues:
# /etc/init.d/docker restart
Try running docker with the following:
docker run -d -p 8888:8080 mytomcat_858
Then,
You can do docker stop mytomcat_858, and docker start mytomcat_858 to stop and start the process. Do not repeat docker run command for the second time.

Get TeamCity running on Docker

I'm brand new to both TeamCity and Docker. I'm struggling to get a Docker container with TeamCity running and usable on my local machine. I've tried several things, to no avail:
I installed Docker for Mac per instructions here. I then tried to run the following command, documented here, for setting up teamcity in docker:
docker run -it --name teamcity-server-instance \
-v c:\docker\data:/data/teamcity_server/datadir \
-v c:\docker\logs:/opt/teamcity/logs \
-p 8111:8111 \
jetbrains/teamcity-server
That returned the following error: docker: Error response from daemon: Invalid bind mount spec "c:dockerdata:/data/teamcity_server/datadir": invalid mode: /data/teamcity_server/datadir.
Taking a different tack, I tried to follow the instructions here - I tried running the following command:
docker run -it --name teamcity -p 8111:8111 sjoerdmulder/teamcity
The terminal indicated that it was starting up a web server, but I can't browse to it at localhost, nor at localhost:8111 (error ERR_SOCKET_NOT_CONNECTED without the port, and ERR_CONNECTION_REFUSED with the port).
Since the website with the docker run command says to install Docker via Docker Toolbox, I then installed that at the location they pointed to (here). I then tried the
docker-machine ip default
command they suggested, but it didn't work, error "Host does not exist: "default"". That makes sense, since the website said the "default" vm would be created by running Docker Quickstart and I didn't do that, but they don't provide any link to Docker Quickstart, so I don't know what they are talking about.
To try to get the IP address the container was running on, I tried this command
docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
That listed the names of the running containers, each followed by a hyphen, then nothing. I also tried
docker ps -a
That listed running contaners also, but didn't give the IP. Also, the port is blank, and the status says "exited (130) 4 minutes ago", so it doesn't seem like the container stayed alive after starting.
I also tried again with port 80, hoping that would make the site show at localhost:
docker run -it --name teamcity2 -p 80:80 sjoerdmulder/teamcity
So at this point, I'm completely puzzled and blocked - I can't start the server at all following the instructions on hub.docker.com, and I can't figure out how to browse to the site that does start up with the other instructions.
I'll be very grateful for any assistance!
JetBrains now provides official docker images for TeamCity. I would recommend starting with those.
The example command in their TeamCity server image looks like this
docker run -it --name teamcity-server-instance \
-v <path to data directory>:/data/teamcity_server/datadir \
-v <path to logs directory>:/opt/teamcity/logs \
-p <port on host>:8111 \
jetbrains/teamcity-server
That looks a lot like your first attempt. However, c:\docker\data is a Windows file path. You said you're running this on a mac, so that's definitely not going to work.
Once TeamCity starts, it should be available on port 8111. That's what -p 8111:8111 part of the command does. It maps port 8111 on your machine to port 8111 in the VM Docker for Mac creates to run your containers. ERR_CONNECTION_REFUSED could be caused by several things. Two most likely possibilities are
TeamCity could take a little while to start up and maybe you didn't give it enough time. Solution is to wait.
-it would start the TeamCity container in interactive mode. If you exit out of the terminal window where you ran the command, the container will also probably terminate and will be inaccessible. Solution is to not close the window or run the container in detached mode.
There is a good overview of the differences between Docker for Mac and Docker Toolbox here: Docker for Mac vs. Docker Toolbox. You don't need both, and for most cases you'll want to use Docker for Mac for testing stuff out locally.

Resources