Bluemix Secure Gateway Client - Fail to connect Tunnel - ibm-cloud

I have installed docker inside internal server it requires ibm bluemix docker client.
Use the command below.
docker run -it ibmcom/secure-gateway-client <id> -t <security_token>
But it only returns.
How do i fix and debug the issue ?

Related

run eclipse docker tooling with Podman backend on Windows

want to use Eclipse with Podman backend on Windows. I have Podman Desktop installed and the podman context is:
Name URI Identity Default
podman-machine-default ssh://user#localhost:64926/run/user/1000/podman/podman.sock C:\Users\me.ssh\podman-machine-default true
podman-machine-default-root ssh://root#localhost:64926/run/podman/podman.sock C:\Users\me.ssh\podman-machine-default false
Eclipse's Docker tooling has a setting for Container engine like the following:
It takes either a unix socket or a TCP connection, but none of them accept the value specified by Podman URI like ssh://user#localhost:64926/run/user/1000/podman/podman.sock.
Is there a workaround I can connect Eclipse to Podman engine on Windows?
There is a workaround that I learned from Red Hat engineer Jason Greene to make Eclipse Docker Tooling (EDT) work with Podman as a backend:
First, create a ssh connection to the podman machine with the L flag and expose a TCP proxy on a specific port.
podman machine ssh -- "-L5555:/run/user/1000/podman/podman.sock" -N
Then, in the TCP connection section of New Docker Connection dialog enter:
tcp://localhost:5555. The tooling will connect to the remote podman engine and can perform container operations.

Kubernetes error when deploying in AWS, how to deploy

I'm trying to build a website in AWS using Docker and Kubernetes, however I'm getting the error The connection to the server localhost:8080 was refused - did you specify the right host or port?
I don’t have a specific file for Kubernetes, but a folder with all of them. So I'm building on this way:
docker build .
kubectl apply -f ./helm/cognos-proxy-login-chart --recursive
Docker command completed successfully.
Am I building in the right way? What should I do?

Docker : java.net.ConnectException: Connection refused - Application running at port 8083 is not able to access other application on port 3000

I have to consume an external rest API(using restTemplate.exchange) with Spring Boot. My rest API is running on port 8083 with URL http://localhost:8083/myrest (Docker command : docker run -p 8083:8083 myrest-app)
External API is available in form of public docker image and after running below command , I am able to pull and run it locally.
docker pull dockerExternalId/external-rest-api docker
run -d -p 3000:3000 dockerExternalId/external-rest-api
a) If I enter external rest API URL, for example http://localhost:3000/externalrestapi/testresource directly in chrome, then I get valid JSON data.
b) If I invoke it with myrest application from eclipse(Spring Boot Application), still I am getting valid JSON Response. (I am using Windows Platform to test this)
c) But if I run it on Docker and execute myrest service (say http://localhost:8083/myrest), then i am facing java.net.ConnectException: Connection refused
More details :
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:3000/externalrestapi/testresource": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
P.S - I am using Docker on Windows.
# The problem
You run with:
docker run -p 8083:8083 myrest-app
But you need to run like:
docker run --network "host" --name "app" myrest-app
So passing the flag --network with value host will allow you container to access your computer network.
Please ignore my first approach, instead use a better alternative that does not expose the container to the entire host network... is possible to make it work, but is not a best practice.
A Better Alternative
Create a network to be used by both containers:
docker network create external-api
Then run both containers with the flag --network external-api.
docker run --network "external-api" --name "app" -p 8083:8083 myrest-app
and
docker run -d --network "external-api" --name "api" -p 3000:3000 dockerExternalId/external-rest-api
The use of flag -p to publish the ports for the api container are only necessary if you want to access it from your computers browser, otherwise just leave them out, because they aren't needed for 2 containers to communicate in the external-api network.
TIP: docker pull is not necessary, once docker run will try to pull the image if does not found it in your computer.
Let me know how it went...
Call the External API
So in both solutions I have added the --name flag so that we can reach the other container in the network.
So to reach the external api from my rest app you need to use the url http://api:3000/externalrestapi/testresource.
Notice how I have replaced localhost by api that matches the value for --name flag in the docker run command for your external api.
From your myrest-app container if you try to access http://localhost:3000/externalrestapi/testresource, it will try to access 3000 port of the same myrest-app container.
Because each container is a separate running Operating System and it has its own network interface, file system, etc.
Docker is all about Isolation.
There are 3 ways by which you can access an API from another container.
Instead of localhost, provide the IP address of the external host machine (i.e the IP address of your machine on which docker is running)
Create a docker network and attach these two containers. Then you can provide the container_name instead of localhost.
Use --link while starting the container (deprecated)

Not able to connect SpringBootApplication to mongo container in Docker

I'm having docker container up and running by using the following command:
docker run -p 27017:27017 -d mongo
Docker Logs for reference.
Then I clone a github repo: https://github.com/springframeworkguru/spring-boot-mongodb.git
Import the project in IntelliJ IDE, build it and run.
SpringBoot App Error Logs here
Issue : I'm not able to connect to the mongo app running in the container from my SpringBoot application as I'm getting MongoSocketOpenException as shown in the logs.
Any help is appreciated?
Docker version 18.03.0-ce, build 0520e24302
OS: Windows 10
Docker for win has some problems with loopback interfaces.
https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/
Try run docker inspect and configure your application with the container address.
Problem: I was trying to configure SpringBoot Application to mongo container IP which I retrieved from mongo inspect <mongo_container> command which was incorrect.
Solution: Configured my application using docker IP retrieved by docker-machine <env> which resolved the problem.
Link to the post is here.

REST request from one docker container to another fails

I have two applications, one of which has a RESTful interface that is used by the other. Both are running on the same machine.
Application A runs in a docker container. I am running it using the command line:
docker run -p 40000:8080 --name AppA image1
When I test Application B outside a docker container (in other words, before it is dockerized) Application B successfully executes all RESTful requests and receives responses without problems.
Unfortunately, when I dockerize and run Application B within a container:
docker run -p 8081:8081 --name AppB image2
whenever I attempt to send a RESTful request to Application A, I get the following:
Connect to localhost:40000 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused
Of course, I also tried making Application B connect using my machine's IP address. When I do that, I get the following failure:
Connect to 192.168.1.101:40000 failed: No route to Host
Has anyone seen this kind of behavior before? What causes an application that communicates perfectly well with another dockerized application outside a docker container to fail to communicate with that same dockerized application once it is itself dockerized???
Someone please advise...
Simply linking B to A docker run -p 8081:8081 --link AppA --name AppB image2, then you can access the REST service using AppA:8080.
The reason is that Docker containers run on its own subnet (normally 172.17.0.0-255) and they cannot access the network that your host is on. Also localhost would be the container itself, not the host.