Trying to get Xdebug session initiated in a docker inside a VM to reach my remote computer - docker

I have a docker running my PHP app.
This docker needs to run inside a VM in a remote datacenter.
I work from a computer that can connect to the mentioned VM.
My intention is to have the Xdebug session that is initiated inside the docker reach my computer (more precisely my PHPStorm).
Both docker and the VM are running Centos (company approved/installed images).
The development computer is OSx.
I am able to use ssh remote forward (aka: tunnel) to forward any requests from the VM to my computer.
I want to either:
- be able to open a tunnel from my computer directly to the docker container in the VM
- or be able to continue the current tunnel in from the VM to the docker.
Have found no way to do the first option and have ran into a lot of issues trying to do the second.
Any suggestions?

Related

VSCode combine remote ssh and remote containers

On my office desktop machine, I'm running a docker container that accesses the GPU. Now, since I'm working from home, I'm connected through ssh to my office desktop computer in vs code via remote ssh plugin which works really well. However, I would like to further connect via remote containers to that running container in order to be able to debug the code I'm running in that container. Failed to get this done yet.
Anyone has any idea if this is possible at all and in case any idea how to get this done?
Install and activate ssh server in a container.
Expose ssh port via docker
create user with home directory and password in container
(install remote ssh extension for vs code and) setup ssh connection within the remote extension in vs code and add config entry:
Host <host>-docker
Hostname your.host.name
User userIdContainer
Port exposedSshPortInContainer
Connect in vs code.
Note: Answer provided by OP on question section.

Exposing Docker Container to outside world

I'm currently learning Kubernetes as part of a project and facing a small hurdle which I hope you guys can help me in crossing.
The ask is to build a docker application that can be accessed over the internet by anyone anywhere. Below are the steps I followed.
I'm using Windows laptop
I used VMWare Workstation to install Ubuntu 20 LTS.
Inside Ubuntu, I've deployed my docker image - using ubuntu terminal
Currently, the applications are accessible within the ubuntu (using Localhost as well as, the URL generated by minikube (using the command minikube services <application_name> --url.
Since within Ubuntu my localhost is working I tried using the ip addr show to get my ubuntu's IP address and then tried accessing it from my windows machine and no result.
Now I want to use the postman installed on my windows machine to hit the container that's running within ubuntu.
I'm new to this entire process so apologies if my question sounds dumb.
First, make sure your network mode for your VMWare is "bridge" (as in here, for VirtualBox, but the same idea applies to VMWare Player)
Then you can use ngrok (as described in "Expose Docker Container services on the Internet using the ngrok docker image" from Lucas Jellema) to generates a public URL and ensures that all requests sent to that URL are forwarded to a local agent (running in its own, stand alone Docker container) that can then pass them on to the local service.

Running couchbase cluster with multiple nodes in docker on windows 10

I created a couchbase 4.0 docker container with single node on windows 10. And added node ip in host machine loopback and forwarded port in vitural box so that couchbase client in my app running in host can connect with node in cluster. I was able to connect and do db operation when I have single node in cluster.
However when I created multiple node cluster in docker on windows 10. I was not able to do db operation. In golang app running in host I got message unable to complete action after 6 attemps on get and set operation.
How to run couchbase cluster of multiple nodes in docker on same host in windows machine so that I can connect with cluster and do db operation from app running in host machine.
If your app is not running inside of Docker host, as far as I know, you can't do this (I would LOVE to be proven wrong by a Docker expert).
Couchbase clients need access to every node in the cluster, and with Docker you can only forward one image to a given port outside the host. (FYI, there is a tool called sdk-doctor which you can use to verify connectivity/networking issues called SDK Doctor).
I would suggest running your golang app inside of the Docker host (using docker-compose is the way this is typically done).
Also, I would highly suggest upgrading to a more recent version of Couchbase.

how to get started with docker version of hortonworks after install

I followed the Docker installation (using the bash script) to install Hortonworks Sandbox onto a server via the Docker component. It is installed on ubuntu 18.04 server.
The install apparently worked. Now what I want to do is be able to get to the website from other machines in the network.
My IP range is standard 192.168.1.*, however, the sandbox container IP is 172.18.0.2. I want to reach the container from outside the server it's installed on. I'm told NAT will work, but I don't know how to work this.
How do I tell Docker/Ubuntu to forward requests to the sandbox? Or change the sandbox IP to something recognizable by other machines on the network?
Use docker run --network=host and all your ports will be listening via your host ip.

Use real server instead of docker-machine for OSX

I have a linux on cloud with a installed docker service on it. How can I use my VS on cloud instead of docker-machine on my OSX? it means instead of install VirtualBox and create a VM on it by docker-machine, I use my server on cloud as docker server.
To access a remote Docker daemon simply pass the -H flag to your docker commands:
docker -H=tcp://192.168.0.100:2375 images
You need to ensure that the remote Docker daemon is listening on the appropriate network interface. Be aware though that doing this on an external server is highly insecure, anyone that can reach the port has effectively root access on the server. At the very least read this article on securing the Docker daemon.
Personally I would only recommend using a port binding via ssh tunnel to access the remote Docker daemon.
You might get a solution from docker-machine's generic driver. Just start the virtual server in cloud, set up proper SSH keys and get started :) It should work just the same as with a VM within VirtualBox.
I'm not sure how to get VS auto-started if it is shut down though. Via a could-vendor specific command line program?
Edit: I should have read the docs better, the first cloud example actually shows the usage of digital ocean driver. If it is already running then just use the generic driver.

Resources