Allow bootp for dnsmasq in docker container - docker

I try to run dnsmasq which have to provide DHCP + BOOTP,
but dnsmask doesn't open 67\udp port when it is running in container.
With similar configuration file on the host system it works properly.
I run container with flags -net host and -privileged, but it doesn't help me.
Why dnsmasq doesn't want to open 67/udp (BOOTP server) into container?
How I able to fix it for doing that?

the root cause isn't in docker configuration.
I missed to add configuration file /etc/dnsmasq.d/default.conf with required parameters.
After adding it 67 port was opened and exposing began works

Related

How to make all containers (docker) use a dns server (coredns) that is running also in a container?

I have setup coredns to run in a container and everything is working. I would like to force all containers going forward to use this DNS from the this container. The DNS server I installed was coredns.
I know I can use "dns" from a docker-compose but this requires a IP address and my container doesn't have a fixed IP.
Is there some way to force all container to use this specific container as their "port 53" dns server
Thanks in advance
no, if you are not able to setup static IP for coredns you must manually update /etc/resolv.conf in every container after each build/reboot or run docker with --dns parameter
with static you can setup global dns for all in /etc/docker/daemon.json and restart docker service

DNS issue when using Docker

From a Spring Boot application running on a docker container, I am trying to connect to Rabbit MQ, Storm and other services which are also running on a docker container. It is working fine when using IP address like x.x.x.x but the same is not working when using the DNS name for that IP. In the command prompt I am able to ping and get a successful response for the same DNS name. Requesting for your help and support in this issue.
You said that you can resolve DNS on the command line. If you mean the command line of the host machine (outside of of the docker container), then the issue is probably with the container's own DNS settings.
A container has it's own network settings. Take a look at the /etc/resolv.conf file being used by the Spring Boot container - this will show you that container's DNS settings.

gitlab running inside docker container

I have a machine with ssh running on it. Now, I wanted to run the gitlab inside the docker container. So, followed the instructions mentioned here https://docs.gitlab.com/omnibus/docker/. The instruction says bind the container ssh port 22 with host machine's ssh port(22). I was unable to do this because port was already binded with openssh server in the host machine. So I binded the container's ssh port to some other port say 222 or so. Doing so gitlab got set-up but when I try to clone the project using ssh way I am not able to do.
Is there a way to fix this issue? what could be reason, I suspect it's because of the port mapping. I want to have the ssh running on my host machine, run the gitlab inside the container and should be able to use ssh way for code commit,clone and push.
Docker port mapping is one thing but you also need to adapt the gitlab rails configuration in gitlab.rb to specify the custom ssh port :
gitlab_rails['gitlab_shell_ssh_port'] = 222
and restart the container

How to send a request from inside a docker container to the outside hostname/port of this container?

I have a web application running inside a php:7.1.8-apache docker container. The application has port 80 inside the container and port 8080 outside of it.
One part of the application sends requests to itself, but uses the outside hostname/port (for example to http://outsidehostname.local:8080).
This doesn't work because the port and the hostname does not exist inside the container.
I already tried the --hostname flag, but this doesn't solve the problem with the different port inside and outside of my container. So I am looking for a different solution.
The hostname (outsidehostname.local) comes from the host os (in my case macos). I am using dnsmasq to resolve all *.local hostnames to 127.0.0.1.
Is there any way to configure docker so that this request works without changing the behavior of the application?
In docker you have various options to set hostnames that can be resolved from container to container: When to use --hostname in docker?
This doesn't work because the port and the hostname does not exist inside the container.
Why not? Where does this outside hostname come from?
Hostnames that cannot be resolved by docker could be resolved by other DNS servers configured on OS or network level. In general how a hostname will be resolved is not a trivial question and you first need to understand how / where your outside hostname is defined and resolved.
UPDATE:
The hostname (outsidehostname.local) comes from the host os (in my case macos). I am using dnsmasq to resolve all *.local hostnames to 127.0.0.1.
This explains your problem: log in to your running container (assuming it's Linux based) using docker exec -it <containerId> /bin/sh then inside the container if you try to look up outsidehostname.local you should see that outsidehostname.local cannot be resolved because there is no such DNS info inside the container OS. If it could be resolved to 127.0.0.1, your next problem would indeed be the wrong port.
Basically running the webserver inside the container defeats the purpose of running your own OSX DNS resolver outside the container. I don't know enough about your use case to really suggest a good solution, but for Linux based images you can always edit /etc/hosts or /etc/resolv.conf.

How to connect local kafka in docker container?

I have a kafka server in my local host, and i want to connect it in my docker container.
I had searched how to connect local services in docker container and i found this: how-to-connect-to-local-mysql-server-through-docker
But it didn't work. Please help me, thanks~
Try updating kafka config as shown below
$ nano config/server.properties
uncomment listeners and paste the following
listeners=PLAINTEXT://<local-ip>:9092
save file & restart kafka.
Hope this helps!
https://github.com/provectus/kafka-ui/discussions/1081
In my Kafka server.properties I had advertised.listeners=PLAINTEXT://localhost:9092. This only allow access via localhost. Once I changed it to my machine's IP address everything worked fine.
If I understand right, you question can be re-phrased as "How can I access my host machine withing my docker container".
As i wrote in another answer, you can set gateway when starting your container, create some kind of proxy to access your Kafka or take the host ip from container.

Resources