how to connect docker mongodb which is in oracle linux virtual machine to mongodb compass - docker

I installed mongodb inside docker container in oracle linux virtual machine. I need to connect this mongodb with mongodb compass. I don't have user account for mongodb and don't have mongod config file in the docker or in virtual machine.
More Information:
I created oracle linux virtual machine from oracle cloud. Then, using my current system's(windows) command prompt, I connected to that machine. Through that, I created a docker container inside the virtual machine. And then, I installed mongodb-6.0.2 inside the docker container. Now, when I try to connect this mongodb database(in virtual machine) to the mongodb compass, It is connecting to my current system's mongodb database(which was installed before the creation of this virtual machine). I also attached the screenshot of my virtual machine's docker and mongodb's information in cmd.
Here is the screenshot of ip of my docker inside the virtual machine
Can anyone solve this issue and tell me how can I make connection of this virtual machine database to mongodb compass?

If wanting to use Compass from Windows and connect to a MongoDB container running an Oracle cloud compute instance, you'll need to make sure networking allows for connections to port 27017 via an ingress rule in your network security group.
Another option is to use port forwarding over ssh.

Related

How to get Docker Desktop to bind on a virtual interface

If I run Docker locally and I bind the containers' ports, I usually connect with them through localhost and not through the dynamically created IP address. I might start a MySQL container, bound with 3306:3306 and can then connect with it to localhost:3306.
If I am using a virtual machine in Windows to run Docker in (e.g. with VirtualBox), the VM has its own interface (e.g. VirtualBox Host-Only Network) which might have an IP address of 192.168.50.1. I can now connect to a MySQL container via 192.168.50.1:3306.
Using a different interface/network for my containers is useful during development because I free up my localhost ports for other things and many browsers treat localhost differently than it does other addresses.
However, Docker Desktop also has advantages over a VM:
Not having to manage the VM
Testcontainers out-of-the-box
Docker Desktop is nice
Should it not be possible to get Docker to bind to ports on a virtual interface instead of localhost, e.g. by creating a Windows virtual switch or even by using the existing VirtualBox network? And is it possible to do this for Docker Desktop (on Windows) for all containers by default?
This answer indicates there's an --ip option available when starting the Docker daemon, but:
Which IP address do I use here? The gateway is the only IP address that I have configured for a virtual switch.
What is the equivalent for Docker Desktop?

Docker desktop networking Windows and Linux nodes

I have a windows service within a Docker container that needs to access a MySQL database in a Linux container on the same machine (dev machine currently).
I thought of creating an overlay network on the two "nodes" on the same machine but this isn't possible as creating the swarm worker fails on windows after creating the swarm master on linux.
Is this possible, if not what is the easiest way of doing this? The purpose of the windows container is simply to deploy to a test environment to gather data. Do I need to deploy the linux to the cloud or another machine maybe, so the windows container can communicate?
You can simply use docker compose, it will create the network automatically. Replace the MySQL host with the MySQL service name you defined in the compose yaml file. Detailed information please refer to docker-compose.

I want to connect a Docker Superset container to an existing external MySQL database

I am trying to add an existing MySQL database as a source database to a docker container running Apache Superset. The MySQL database that I am trying to add is not running in a docker container. It's an existing MySQL database running on a Windows machine.
I've added mysqlclient==1.4.6 to requirements.txt. The error message seems to indicate that the driver is installed.
I've used mysql://user:password#127.0.0.1:3306/database_name and mysql://user:password#localhost:3306/database_name
The error I get is:
"ERROR: Connection failed, please check your connection settings."
I am using image: apache / 'incubator-superset' v. 0.36.0
Are there any settings or config that needs to be changed to be able to communicate to an external database from within a running docker container?
So I figured it out. For Windows, run ipconfig (maybe ifconfig linux, mac) in terminal/powershell and check what ip address docker ethernet port is using (listed as WSL), let's say ip is: 172.x(x).x(x).x(x). Then configure connection string with ip address on docker ethernet port as follows: 'mysql://user:password#172.x(x).x(x).x(x):3306/database_name'.
Follow-up question if anybody knows: How can I connect my docker container running apache/superset to another server/ip address on my local network running a MySQL server? In other words I want to connect the apache/superset app that is running on my computer in a docker container, to another computer on my local network that is running a MySQL server. The MySQL sever is not in a docker container.
maybe the steps of this blog can help.
If your mysql is in other docker it it is not 127.0.0.1 and in addition if you don't want the requirements to be updated every time that you git pull a new docker, it is better to use the requirements-local.txt
You should be able to do that but your MySQL has to have external IP that you can access from your Supserset Machine. First do a telnet to see if you can listen from port 3306 to that machine and if you can Supserset should work with very similar URI that you have.

couchdb on docker: open console

I am new to both dockers and couchdb.
I have a Linux box (let's call it A) on which I have docker installed. On this, I am running a container (lets called it docker1) on which I've installed couchdb.
I now need to open the couchdb console and open the views. I know I can normally do it by doing http://localhost:ip/, but in this case couchdb is installed on a docker container. I know we can access the container port from the docker container host. However, I need to access the couchdb instance running on a docker container (docker1) from the Windows PC from which I am accessing the Linux box A.
Is there a good way to access the console from the Windows PC?
If not, is there a way to access the couchdb view? I want to edit it so that there are multiple keys.
Assuming you have GUI access to your Linux box (from your description, I'm guessing it's not just a VM hosted on the Windows box), and if you're using a recent build of CouchDB (and the default port), you should be able to administer your CouchDB databases from your Linux box by navigating to http://localhost:5984/_utils/index.html in a browser.
If you only have command-line access to your Linux box, you should be able to access the same interface from your Windows box as long as the port (5984) is open and accessible to HTTP traffic.
execute this on the Linux host.
docker run -p 5984:5984 -d couchdb
Now you can connect from the Windows host by using the LAN ip of the Linux host and the port 5948.

Can't connect to VM from Host in HostOnlyNetwork Configuration

I am trying to create a VM on my Ubuntu linux machine. The VM I am trying to create is 12.04 Ubuntu 32 bit virtual machine. I have had success creating said VM from a Windows environment, but when I migrated to a 16.04 Ubuntu environment I can't replicate my success. The problem comes from when I chose a HostOnly network for my VM. On my windows computer, after setting the IP and subnet mask using Host network manager on Virtualbox, Upon selection of a VirtualBox host only adapter, I was able to make Packer ssh into my VM. However, when I tried the same thing on my Ubuntu machine, going to preferences -> network, and setting the IP and subnet mask, whenever I select VBoxnet0 and than have Packer attempt to ssh or when I ping into my VM from my Ubuntu machine, I get host unreachable. Both netstat and ifconfig are telling that vboxnet0 is there. Based on what I have written, what might be the reasons I can't connect to my VM?

Resources