Using mongo client from docker container

Vladimir Garvardt shared this question 19 months ago
Answered

I do not have locally installed mongo and I run most of the DBs clients apps in containers, e.g. redis-cli, mongo, psql, etc. I tried to set Mongo Path to the following value "docker run mongo mongo" in bdKoda but it fails with the following error:


Failed to update config: {"config.mongoCmd":"\u001b[31mCommand failed: \"docker run mongo mongo\" --version\n/bin/sh: docker run mongo mongo: command not found\n\u001b[39m"}


And here is what I get when I run it in the shell:


$ docker run mongo mongo --version

MongoDB shell version v3.6.3

git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5

OpenSSL version: OpenSSL 1.0.1t 3 May 2016

allocator: tcmalloc

modules: none

build environment:

distmod: debian81

distarch: x86_64

target_arch: x86_64


Am I using wrong value for Mongo Path or running mongo client in container is not supported at all?

Comments (6)

photo
2

Hi Vladimir,


First up thanks for trying dbKoda and providing us with some feedback.

At the moment dbKoda doesn't support running the mongo client from a container, but it's something we've been wanting to add for a while, so with your request we've got a great excuse to prioritize this work! I've added the task to our next release and I'll update this ticket once it's available for you to download :)


Kind Regards,

Mike from dbKoda.

photo
1

Thank you for the answer. Will wait for the update.

photo
1

I'm very interested in this as well! I use docker to manage many different mongo environments for multiple clients. Your client is amazing so I'll be checking back on progress for this request! Keep up the good work!

photo
1

Hi guys,


We've just released version 1.0 of dbKoda, including support for Docker! The full list of additions can be seen here: https://medium.com/dbkoda/dbkoda-1-0-is-released-w00t-45ea64f25a13


You can get the latest version of the App from http://www.dbkoda.com.


Cheers,

Mike from dbKoda.

photo
1

I'm trying v1.0 with docker, set mongo:3.4 as the image, but still get the shell error.

Here is my Paths screen:


/mzDhg0PJT0b2U0aRtlQx3yAkHhP3rlz58qenp5dpaWlE0tKSsqTPRHKR9k86A4BAgQIECBAgAABAgQIECBAgAABAgQIjGKBvr6+9s7OzvWbNm369saNGx9Muro9+VkzirusawQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECAwSgT+P0r9mCtbwKSmAAAAAElFTkSuQmCCAA==

My ~/.dbKoda/config.yml file contents:

user:

id: MDovsh3012vDtFhvYvq~~

mongoCmd: null

drillCmd: null

drillControllerCmd: null

mongoVersionCmd: null

mongoexportCmd: null

mongoimportCmd: null

mongodumpCmd: null

mongorestoreCmd: null

telemetryEnabled: true

showNewFeaturesDialogOnStart: true

tableOutputDefault: true

automaticAutoComplete: true

showWelcomePageAtStart: true

passwordStoreEnabled: false

dockerEnabled: true

docker:

createNew: true

imageName: 'mongo:3.4'

containerID: ''

hostPath: ''

containerPath: ''

mongoCmd: 'docker run -it --rm mongo:3.4 mongo'

mongorestoreCmd: 'docker run --rm mongo:3.4 mongorestore'

mongodumpCmd: 'docker run --rm mongo:3.4 mongodump'

mongoexportCmd: 'docker run --rm mongo:3.4 mongoexport'

mongoimportCmd: 'docker run --rm mongo:3.4 mongoimport'

mongoVersionCmd: 'docker run mongo:3.4 mongo --version'

performancePanel:

preventDisplaySleep: false

metricSmoothingWindow: 6

foregroundSamplingRate: 5000

backgroundSamplingRate: 15000

historySize: 720

historyBrushSize: 30

alarmDisplayingWindow: 60000

maxOutputHistory: 1000

Error when I test connection:

/H0eNfdGhhokcAAAAAElFTkSuQmCCAA==

And error when I try to Connect:

/AU3WiIUHSXpYAAAAAElFTkSuQmCCAA==

Image exists locally:

$ docker run mongo:3.4 mongo --version

MongoDB shell version v3.4.15

git version: 52e5b5fbaa3a2a5b1a217f5e647b5061817475f9

OpenSSL version: OpenSSL 1.0.1t 3 May 2016

allocator: tcmalloc

modules: none

build environment:

distmod: debian81

distarch: x86_64

target_arch: x86_64

photo
1

Hi Vladimir,

Thank you for reporting this issue back to us. It seems that we have an env path issue in macOS's production build, and we are working on a fix now. In the meantime, could you please try this workaround:

• replace all `docker run` with the full path to docker, e.g. `/usr/local/bin/docker run`, in your `config.yml`

fbe381fe1925b07ff40f7b9c205e080c

Thanks,

Guan from dbKoda

photo
2

This helped, thx!

photo
1

Hi,

I am also having this same issue - however when I tried adding the full path to docker, this did not resolve the issue for me.

Cheers Tim.

photo
1

Hi Tim,

Sorry for the delayed response. Can you tell me a bit more about your environment so that I can better diagnose the issue for you. e.g

Which platform you are trying dbKoda?

Where is your mongo server hosted? Local or on cloud?

Which Docker Image you want to use?


Best Regards,

Wahaj from dbKoda

photo
1

Hi Wahaj,

I am using a Mac Book Pro (OS 10.14.2)

I have various servers I am trying to connect to - A couple of local test one's - both hosted in Docker, and a couple of servers that are hosted on Atlas - and another that is hosted on ScaleGrid.

I didn't specify an image tag - assuming that would just get the latest image as per normal docker operation.

Cheers Tim.

photo
1

Hi Tim,

For your local Docker based servers, you might have to create an alias for your localhost and connect using that alias. Here is the command you can try and then connect to your local docker mongo using 172.16.0.1:27017


sudo ifconfig lo0 alias "172.16.0.1/16"

Try our nightly version from this link where we have fixed this issue. Just configure the docker path from settings and remove the image tag.

 


https://github.com/SouthbankSoftware/dbkoda/releases/download/31-01-2019/dbKoda-1.0.1.31-01-2019.dmg


We are planning to release a new version soon, in the meantime really sorry for the inconvenience.


Cheers.

photo
photo
1

Yaml formatting got broken, but "code" button simply does not work for me in this editor - page get blurred and nothing happens untill I press ESC.

photo
1

The `code` button should be fixed now. Sorry for the troublesome :P

photo