I run docker container by docker-compose.yml file.
Below he setting for the container in problem.
test:
image: captainteemo/aips:1.0
container_name: test
hostname: test
volumes:
- /home/{{.Node.Hostname}}/share/hosts:/etc/hosts
- /home/{{.Node.Hostname}}/share/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
environment:
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
- JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
privileged: true
cap_add:
- NET_ADMIN
tty: true
command: /sbin/init
ports:
- 8128:8128
deploy:
placement:
constraints:
- node.hostname == user1
The binding port is a port for back-end server access.
However, when running a backend server using uvicorn, access is not possible. Also, if i check the port with 'netstat', the 8128 port is not confirmed.
So after installing the 'iptables' package, I tried to open the port with the 'iptables -I INPUT 1-ptcp --dport 8128-j ACCEPT' command, but I get the same error as below.
iptables v1.6.1: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
I tried to search this error and solution, but never is worked...
How can I solve it???
ADD. I start server by command by
uvicorn main:app --reload --host=0.0.0.0 --port=8128
but when I checked netstat, below result:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:33727 0.0.0.0:* LISTEN -
ADD.
If I run server in 'user1' docker node, Below is print and stucked:
INFO: Will watch for changes in these directories: ['/home/zioz/server_place/test_web']
INFO: Uvicorn running on 0.0.0.0:8128 (Press CTRL+C to quit)
INFO: Started reloader process [531] using StatReload
If I run server in other(leader) docker node, Below is print and run well:
INFO: Will watch for changes in these directories: ['/home/zioz/server_place/test_web']
INFO: Uvicorn running on 0.0.0.0:8128 (Press CTRL+C to quit)
INFO: Started reloader process [531] using StatReload
INFO: Started server process [429]
INFO: Waiting for application startup.
INFO: Application startup complete.
Related
I want to use port 8080 on my local machine for a container service. Here is the relevant part of my docker-compose
services:
pgadmin:
image: dpage/pgadmin4
environment:
- PGADMIN_DEFAULT_EMAIL=admin#admin.com
- PGADMIN_DEFAULT_PASSWORD=root
volumes:
- "./data_pgadmin:/var/lib/pgadmin:rw"
ports:
- "8080:80"
However, port 8080 was already in use by other process when I ran docker-compose up
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:8080 -> 0.0.0.0:0: listen tcp 0.0.0.0:8080: bind: address already in use
I checked to see what process is listening on port 8080
netstat -ltnp | grep -w ':8080'
>> tcp6 0 0 :::8080 :::* LISTEN 155621/rootlesskit
I am using docker rootless so I guess it is using port 8080 by default. I tried killing the process but every time I ran docker-compose it is up again. Is there anyway to stop it from using this port by default?
It turns out I have another container using port 8080. After removing it I can now use port 8080 again. My suggestion for anyone encountering the same issue is to check carefully everything with docker images -a and docker container ls. One more important thing to check is also the context in which you run your docker command with docker context ls.
I'm trying to run mosquitto as docker container in windows 10. Getting below error log Address not available.
1614449526: mosquitto version 2.0.7 starting
1614449526: Config loaded from /mosquitto/config/mosquitto.conf.
1614449526: Starting in local only mode. Connections will only be possible from clients running on this machine.
1614449526: Create a configuration file which defines a listener to allow remote access.
1614449526: Opening ipv4 listen socket on port 1883.
1614449526: Opening ipv6 listen socket on port 1883.
**1614449526: Error: Address not available**
1614449526: mosquitto version 2.0.7 running
Could anyone advise how to solve this error?
Thank you.
I'd the same issue.
My solution was:
Enter to mosquitto container item from portainer.io. then you must loggin by console in mosquitto's container. Select command : /bin/sh for loggin...
Once into command line must to adjust the mosquitto.conf located in : /mosquitto/config
Must change the following parameters: Uncomment and fixed
listener 1883
persistence true
allow_anonymous true
later, exit from command console and restart mosquitto container...and ready !!
check logs!
Hope to help!
i followed Stéphane Trottier's suggestion but ran into issues b/c of the port and an outdated config change:
allow_anonymous true
listener 2883
protocol mqtt
i also used port 2883 instead since it seems 8883 is for tls so i was getting connection refused errors on the client and protocol errors on the server. my docker compose looks like this:
mqtt:
image: eclipse-mosquitto:latest
volumes:
- ./mqtt/config:/mosquitto/config
user: "1000:1000"
ports:
- 1883:2883
I had the same issue yesterday... Generally, some OSs require more permissions to run services on ports lower than 2000. This is how I made it work for me. I'm just running this for a hobby project. For work I would do things differently.
added local mosquitto folder and placed mosquitto.conf file in it.
added allow_anonymous true
changed port to something higher than 2000.
mount local config volume in docker
allow_anonymous true
port 8883
I run it via docker compose file.
version: '3.1'
services:
mosquitto:
image: eclipse-mosquitto
hostname: mosquitto
container_name: mosquitto
ports:
- "8883:8883"
volumes:
- ./mosquitto:/mosquitto/config
networks:
- webnet
networks:
webnet:
The error is gone from my logs and I can connect to it just fine on that port.
1614505908: The 'port' option is now deprecated and will be removed in a future version. Please use 'listener' instead.
1614505908: mosquitto version 2.0.7 starting
1614505908: Config loaded from /mosquitto/config/mosquitto.conf.
1614505908: Opening ipv4 listen socket on port 8883.
1614505908: Opening ipv6 listen socket on port 8883.
1614505908: mosquitto version 2.0.7 running
looks like I'll have to replace port with listener at some point soon.
both azegurelabs and Stéphane Trottier answers worked for me.
but the easier and more accurate solution is to just run image with default provided conf
docker run -it --rm --name mosquitto -p 1883:1883 eclipse-mosquitto:2.0 mosquitto -c /mosquitto-no-auth.conf
or to run image with your config file
docker run -it -p 1883:1883 -v <absolute-path-to-configuration-file>:/mosquitto/config/mosquitto.conf eclipse-mosquitto:<version>
you can read more here: mosquitto docker github page
I'm setting up RubyMine Debugger with Docker but I believe I have an issue with the matching the ports and I can't find documentation that thoroughly explains what the "configuration form in ruby mine is asking for and how to find the related information for the form input fields" all I can find is generic information.
I have had many error messages and even crashing when I click the debugger button. I have tried a lot more then what I'm posting but I never wrote it down. This is just where I am at this current moment
I have followed https://confluence.jetbrains.com/display/RUBYDEV/How+to+setup+and+run+ruby+remote+debug+session
I have added ports to the docker-compose.yml file.
Setup configuration for remote Remote Ruby SDK and Gem.
Setup Ruby remote debug configuration.
I have tried working my way through every error but I just get more as I go.
This app uses docker-compose and I'm not familiar with it at all other then all the reading I been doing to get this debugger setup
docker-compose.yml file
app:
build: wffffffe_api
dockerfile: Dockerfile-development
command: rails server --port 3000 --binding 0.0.0.0
stdin_open: true
tty: true
ports:
- "3000:3000"
- "1234:1234"
- "26162:26162"
volumes:
- './wfffffe_api:/var/www/weffffffe_api'
- './dotfiles/.vimrc-basic:/root/.vimrc'
The debugger configuration
Remote host: 0.0.0.0
Remote port: 3000
Remote root folder: /var/www/wffffffe_api
local port: 26162
local root folder: /Users/josh/Work/wffffffe_api
I have tried doing
docker-compose exec app rdebug-ide --host 0.0.0.0 --port 3000 --dispatcher-port 26162 -- bin/rails server
If the docker container is already running I get:
Fatal exception in DebugThread loop:
Address already in use - bind(2) for "0.0.0.0" port 3000
If the docker container is not already running I get:
Fast Debugger (ruby-debug-ide 0.6.1, debase 0.2.2, file filtering is supported) listens on 0.0.0.0:3000
I then do docker-compose up --build -d
ERROR: for app Cannot start service app: b'driver failed programming external connectivity on endpoint work_app_1 (1e830daaecd39fab784b817a03893b592635542a8dfe3de69859c0ba7d39b483): Error starting userland proxy: Bind for 0.0.0.0:3000 failed: port is already allocated'
Do I need to have two separate servers running?
Your problem is that you are trying to debug on port 3000, which already bound by your rails application.
The --port of rdebug-ide specify the port that RubyMine will use for its debug protocol.
When you execute rails server --port 3000 --binding 0.0.0.0, you are binding port 3000 as your rails application (and not as debug port).
Change your remote port debug to 1234 (which you already exposed in your docker-compose.yml) and it should work.
To summarise, your command should look like:
docker-compose exec app rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server --port 3000 --binding 0.0.0.0
After setup of enketo express, When i run enketo-express using command "docker-compose up -d" on an ubuntu server, it shows an below error related to nginx
ERROR: for docker_nginx_1 Cannot start service nginx: b'driver failed programming external connectivity on endpoint docker_nginx_1 (7c414e255d50f42a0fa14d07c0b0d29125f666d77e55e5eb4437e43e3e4d9454): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use'
ERROR: for nginx Cannot start service nginx: b'driver failed programming external connectivity on endpoint docker_nginx_1 (7c414e255d50f42a0fa14d07c0b0d29125f666d77e55e5eb4437e43e3e4d9454): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use'
By default 80 port is used by the apache service on ubuntu server. This means you need to change your port.
Just try to Bind port 8081 of your ubuntu with the port 80 of the container. For this use this command,
$ run docker run -d -p 8081:80 --name webserver nginx
This creates the link you need to access it at http://localhost:8081/
Note- Change port in "setup/docker/docker-compose.yml" file. eg: 80:80 to 8081:80
It's because something is already running on port 80 on the host machine.
View which process it is, get the PID -
$ lsof -i:80
$ netstat -tulnap | grep :80
Kill the process -
$ kill -9 $PID
Try now & you will be good -
$ docker-compose up -d
I am trying to get this fig image here up and running: https://registry.hub.docker.com/u/harbur/sonarqube/
docker and fig installed fine and also the two images boot normally (including the applications - checked from the logs).
however, there should be a port forwarding setup so that I can connect from my host machine to the sonarqube instance. however, I can't connect to the machines as no port is open on the host OS.
Is there anybody who can give me a hint on what I'm doing wrong?
Cheers,
Matthias
$ docker port dockersonarqube_sonarqube_1
443/tcp -> 0.0.0.0:49154
9000/tcp -> 127.0.0.1:9000
$ curl 127.0.0.1:9000
curl: (7) Failed connect to 127.0.0.1:9000; Connection refused
this is the fig config file:
postgresql:
image: orchardup/postgresql:latest
environment:
- POSTGRESQL_USER=sonar
- POSTGRESQL_PASS=xaexohquaetiesoo
- POSTGRESQL_DB=sonar
volumes:
- /opt/db/sonarqube/:/var/lib/postgresql
sonarqube:
image: harbur/sonarqube:latest
links:
- postgresql:db
environment:
- DB_USER=sonar
- DB_PASS=xaexohquaetiesoo
- DB_NAME=sonar
ports:
- "127.0.0.1:9000:9000"
- "443"
If you're using boot2docker on a Mac, you need to access the website via the VM. You'll need to do two things:
Expose the VM port on all interfaces by changing "127.0.0.1:9000:9000" to "0.0.0.0:9000:9000".
Use the IP of the VM to connect to the server e.g. curl $(boot2docker ip 2> /dev/null):9000
You shouldn't need to muck with port forwarding inside the VM unless you really don't like using the boot2docker IP rather than 0.0.0.0.
With boot2docker on OSX you need to set up port forwarding. You need to run something like:
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port9000,tcp,,9000,,9000";
REF: https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md
Also you need to replace 127.0.0.1 by 0.0.0.0 in your fig.yml file in order to have
- "0.0.0.0:9000:9000"