Cannot add Ngrok command in Dockerfile - docker

I'm trying to add RUN ngrok config add-authoken command in Dockerfile. From the error output, it seems like ngrok config command itself is working fine but for some reason it's not recognizing the add-authtoken part.
My Dockerfile:
FROM node:16
ARG NGROK_TOKEN
RUN npm install -g \
ngrok \
pm2 \
typescript
WORKDIR /app
RUN ngrok config add-authtoken ${NGROK_TOKEN} # Here is where error occurs.
# ...content continues...
The docker build command:
docker build --file="./Dockerfile" --build-arg="NGROK_TOKEN=abc" .
The error:
=> ERROR [ 4/11] RUN ngrok config add-authtoken abc 0.8s
------
> [ 4/11] RUN ngrok config add-authtoken abc:
#7 0.736 NAME:
#7 0.736 ngrok - tunnel local ports to public URLs and inspect traffic
#7 0.736
#7 0.736 DESCRIPTION:
#7 0.736 ngrok exposes local networked services behinds NATs and firewalls to the
#7 0.736 public internet over a secure tunnel. Share local websites, build/test
#7 0.736 webhook consumers and self-host personal services.
#7 0.736 Detailed help for each command is available with 'ngrok help <command>'.
#7 0.736 Open http://localhost:4040 for ngrok's web interface to inspect traffic.
#7 0.736
#7 0.736 EXAMPLES:
#7 0.736 ngrok http 80 # secure public URL for port 80 web server
#7 0.736 ngrok http -subdomain=baz 8080 # port 8080 available at baz.ngrok.io
#7 0.737 ngrok http foo.dev:80 # tunnel to host:port instead of localhost
#7 0.737 ngrok http https://localhost # expose a local https server
#7 0.737 ngrok tcp 22 # tunnel arbitrary TCP traffic to port 22
#7 0.737 ngrok tls -hostname=foo.com 443 # TLS traffic for foo.com to port 443
#7 0.737 ngrok start foo bar baz # start tunnels from the configuration file
#7 0.737
#7 0.737 VERSION:
#7 0.737 2.3.41
#7 0.737
#7 0.737 AUTHOR:
#7 0.737 inconshreveable - <alan#ngrok.com>
#7 0.737
#7 0.737 COMMANDS:
#7 0.737 authtoken save authtoken to configuration file
#7 0.737 credits prints author and licensing information
#7 0.737 http start an HTTP tunnel
#7 0.737 start start tunnels by name from the configuration file
#7 0.737 tcp start a TCP tunnel
#7 0.737 tls start a TLS tunnel
#7 0.737 update update ngrok to the latest version
#7 0.737 version print the version string
#7 0.737 help Shows a list of commands or help for one command
#7 0.737
#7 0.737 ERROR: Unrecognized command: config
------
executor failed running [/bin/sh -c ngrok config add-authtoken ${NGROK_TOKEN}]: exit code: 1

The command you are running is for the v3.X Agent, but you are running a v2.3.41 agent.

Related

Unable to expose port using EXPOSE in Dockerfile

I'm trying to expose a JMX port to monitor SpringBoot Application from minikube.
So I added EXPOSE 9010 in Dockerfile and following in deployment.yaml
- containerPort: 9010
- name: JAVA_OPTS
value: "-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.rmi.port=9010 \
-Djava.rmi.server.hostname=127.0.0.1"
however, the port is not getting exposed. Am I missing something here?
Getting below error when trying to port-forward
Handling connection for 9010
E0223 11:48:52.999502 17966 portforward.go:400] an error occurred forwarding 9010 -> 9010: error forwarding port 9010 to pod 4dc803f4d28b82b98dbc0e8fc1448d760f98694e026fb74511b2b8957aa88ef3, uid : exit status 1: 2021/02/23 06:18:52 socat[16604] E connect(5, AF=2 127.0.0.1:9010, 16): Connection refused
Dockerfile:
FROM openjdk:11
WORKDIR /
ADD target/usgagg-service-0.0.1-SNAPSHOT.jar //
EXPOSE 9010
ENTRYPOINT ["java","-Dspring.profiles.active=local","-jar","usgagg-service-0.0.1-SNAPSHOT.jar"]
Note: Springboot server.port is 8080 and I dint create any service to expose 8080 port, I've just added container port in deployment.yaml and it's working fine. I've problem with 9010 only
Update:
Issue is resolved by modifying ENTRYPOINT in Dockerfile to below.
ENTRYPOINT exec java $JAVA_OPTS -Dspring.profiles.active=local -jar /usgagg-service-0.0.1-SNAPSHOT.jar

Unable to install Docker DTR

I am trying to install docker DTR using a command mentioned below but getting failed
Command:
docker run -it --rm docker/dtr install \
--ucp-node mbk-srv-389-ub \
--ucp-username admin \
--ucp-url https://172.16.217.1 \
--ucp-insecure-tls
But its giving error
ERROR:
FATA[0006] Failed to choose ucp node: The UCP node 'mbk-srv-389-ub' has port conflicts, please pick another node or choose a different port.
So i tried to add port 445 **--ucp-url https://172.16.217.1:445** as port 443 is also used by UCP but then it is showing another error.
ERROR:
FATA[0006] Failed to get new conv client: failed to create http client: Failed to get UCP CA: Get https://172.16.217.1:445/ca: dial tcp 172.16.217.1:445: connect: connection refused
INFO:
port 445 is open on the firewall.
no other service is running on port 445
DTR needs port 443 free, if 443 isn't free the install will fail.
Install UCP with --controller-port to any port other than 443 and then install DTR, it will work

docker tcp retransmission in docker network

TCP rentransmission occurs on any docker network.
simple test: create VM in Azure, centos 7,7
yum update
yum install docker
systemctl start docker
docker run --name mynginx1 -P -d nginx
tshark -tad -i any -Y "tcp.analysis.retransmission"
curl localhost:32768
this results in occurence of TCP Retransmission.
[root#vm1 ~]# tshark -tad -i any -Y "tcp.analysis.retransmission"
Running as user "root" and group "root". This could be dangerous.
Capturing on 'any'
121 2020-04-24 07:26:55.504210673 109.81.211.189 -> 10.0.0.4 SSH 92 [TCP Retransmission] Encrypted request packet len=36
418 2020-04-24 07:27:04.982215355 109.81.211.189 -> 10.0.0.4 SSH 92 [TCP Retransmission] Encrypted request packet len=36
572 2020-04-24 07:27:10.746826933 172.17.0.1 -> 172.17.0.2 HTTP 147 [TCP Retransmission] GET / HTTP/1.1
576 2020-04-24 07:27:10.747858244 172.17.0.2 -> 172.17.0.1 TCP 307 [TCP Retransmission] http > 40514 [PSH, ACK] Seq=1 Ack=80 Win=29056 Len=239 TSval=1217913 TSecr=1217912
580 2020-04-24 07:27:10.747930345 172.17.0.2 -> 172.17.0.1 TCP 680 [TCP Retransmission] http > 40514 [PSH, ACK] Seq=240 Ack=80 Win=29056 Len=612 TSval=1217914 TSecr=1217913[Reassembly error, protocol TCP: New fragment overlaps old data (retransmission?)]
the same problem on Kubernetes (tested with flannel plugin)
this issue significantly reduce the performance of container, in our case high performance message parser inside docker has 4x less results. Using docker host network resolves the issue. But using bridge network causes this issue.
Please any advice/help?
for reference - the reason of retransmission is seen from wireshark as outoforder/duplicate
enter image wireshark trace detail
Finally we identified the problem in used image based on Alpine. After we moved the docker base image into debian/ubuntu retransmission problem gone.

How to fix "listen EACCES: permission denied 0.0.0.0:8000"

I tried to explore Quasar Framework. I download node.js and quasar.cli already. i managed to create project, but when i "quasar dev" in my quasar file, it pop up the errors.
C:\Users\User>cd njir
C:\Users\User\njir>quasar dev
Dev mode.......... spa
Pkg quasar........ v1.2.2
Pkg #quasar/app... v1.2.1
Debugging......... enabled
app:quasar-conf Reading quasar.conf.js +0ms
app:dev Checking listening address availability (0.0.0.0:8080)... +25ms
app:dev ⚠️ Unknown network error occurred +0ms
{ [ Error: listen EACCES: permission denied 0.0.0.0:8080
next_tick.js:63 process._tickCallback
internal/process/next_tick.js:63:19
loader.js:834 Function.Module.runMain
internal/modules/cjs/loader.js:834:11
node.js:283 startup
internal/bootstrap/node.js:283:19
node.js:622 bootstrapNodeJSCore
internal/bootstrap/node.js:622:3
]
code: 'EACCES',
errno: 'EACCES',
syscall: 'listen',
address: '0.0.0.0',
port: 8080 }
C:\Users\User\njir>
Windows users should follow these steps:
Ensure that PowerShell is running as an administrator.
Use the following command to stop winnat:
net stop winnat
Use the following command to restart winnat:
net start winnat
I recently had this error and it resolved when I restarted my machine.
If that doesn't work for you I would try port 80 as a quick check to see if it is a problem with a closed port. Port 80 is for HTTP so it should be open.
quasar dev -p 80
If that works, then port 8080 might not be setup to run your local server.
To check port availability I use nmap (https://nmap.org/). If you install it and want to check a port from the command line run something like:
nmap localhost -p 8080
Port 8080 was not available in network , issue could be resolved by updating dev property in quasar.config.js
devServer: {
// https: true,
//port: 8080,
open: true // opens browser window automatically
},
Uncomment port and change the default port number, for e.g. port: 8089
Restarting my computer helped me solve this problem.

What does "Now listening on: http://[::]:80" mean?

Have created an dotnet core application and when run the command:
docker-compose up
everything goes well but I don't understand what does the below line mean:
Now listening on: http://[::]:80
Dockerfile content is:
FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "SampleCoreApp.dll"]
docker-compose file is:
version: '3'
services:
samplecoreapp:
image: samplecoreapp
build:
context: ./SampleCoreApp
dockerfile: Dockerfile
Why is that I'm not seeing the IP address?
If i have a 3 VMs and if I want to run this application on VM2 then how can I deploy this docker container to VM2?
Now listening on: http://[::]:80
means: your application is telling you that it is listening on TCP port 80 on all IPv6 addresses it owns.
[::] is the short-hand notation for the IPv6 address 0000:0000:0000:0000:0000:0000:0000:0000 within an URL. Note that :: is not a valid IPv6 address, but often is used as an alias for "all my IPv6 addresses".
Similarly, a web server that listens on TCP port 80 of all its IPv4 addresses usually reports that it is listening on http://0.0.0.0:80. In your case, it seems to be expecting IPv6 traffic instead. However, many applications are dual stack and listen to both, IPv4 and IPv6.

Resources