1

I'm running InluxDB on my server in docker container.

this command is ok, when executed from the same server:

curl -G http://localhost:8086/query -u my_user --data-urlencode "q=SHOW DATABASES"

authetification is ok and it prints the databases.

But when I change localhost to public IP, it doesn't work from the same server, and also from some other server (which is the main goal, it should work from another server.

curl -G http://ip_of_the_same_server:8086/query -u my_user --data-urlencode "q=SHOW DATABASES"
  • Please can you post the output of : lsof -i -n -P | grep :8086 Thanks you. – MathieuR Nov 7 '17 at 10:45
  • nothing was printed, but without -i -n -P it prints lsof: no pwd entry for UID 1100 – Július Marko Nov 7 '17 at 10:47
  • Please can you execute this as root ? – MathieuR Nov 7 '17 at 10:49
  • docker-pr 2276 root 4u IPv6 1211554 0t0 TCP *:8086 (LISTEN) – Július Marko Nov 7 '17 at 10:50
  • It seem you are only listenning on IPv6, so you can't connect using IPv4. Maybe you can try setting the bind address to 0.0.0.0:8086 or your_ip:8086. – MathieuR Nov 7 '17 at 10:53
1

You can check if your container is listening on port from any ipv4(0.0.0.0)

docker ps example: 0.0.0.0:8086->3306/tcp

How is your server connected to network via firewall etc, if its connected via firewall then first check if port 8086 is open and are you able to telnet on port from another server

If telnet works then you need to confirm if you have created user in mysql for another server ip access, you need to create user with ip address of another server in order to access mysql or you can use 'user'@'%' with access to required db while creating user this will allow that user from any ip

*GRANT ALL PRIVILEGES ON dbname TO 'username'@'another-server-ip';

or *GRANT ALL PRIVILEGES ON dbname TO 'username@'%';

'%' will allow from any host or ip

use grants as per your usage ex: select, insert, update etc.

Its good to map data volumes of mysql to host folder, its easy to manage backups and managing containers

you can try docker run --name mysql-server -p 3307:3307 -v /var/mysql_data/mysql:/var/lib/mysql -v /opt/done/mysql/my.cnf:/etc/mysql/my.cnf -it mysql sh

In above example volumes are mounted on different path outside container to local host folder

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.