Windows 10 - place docker container directly on local network? - windows

I’ve been trying to place my container direclty on my local network (LAN). I’ve tried setting up macvlan and by using a docker but I’ve been unable to communicate directly to the container.
Here is what I’ve done:
-> Created a “macvlan” network named “pub_net” and gave it the subnet from my LAN.
I could only get the below command to be accepted by using “eth0”. Is this correct? What name is Docker expecting here?
docker network create -d macvlan \
--subnet=192.168.1.0/24 \
--gateway=192.168.1.1 -o \
parent=eth0 pub_net
Ran an image, named it “yuri”, attached it to the newly created “pub_net” network and gave it an IP from the “pub_net” subnet.
docker run -d --net=pub_net --ip=192.168.1.37 --name=yuri -t ubuntu
Once this is complete I’m unable to communicate with the container at 192.168.1.37
Any ideas what I’m doing wrong?
Thanks for any help you can give!

"The macvlan networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server."

Related

Cannot forward ports when running Linux container on Windows10 as a host

I'm new using Docker. I have been trying to deploy a Linux container (with Windows as a host) with a Google Cloud image inside using Docker. I'm able to do everything well, at the end the server is running perfectly, but when I want to check the server, using the localhost in the browser, I got a blank page with:
Blank page
This is the Dockerfile:
FROM google/cloud-sdk
ENV PATH /usr/lib/google-cloud-sdk/bin:$PATH
WORKDIR docker_folder
COPY local_folder/ .
RUN pwd
EXPOSE 8080
CMD ["java_dev_appserver.sh", "."]
This is the command I'm using to build my image (in the CMD):
docker build --tag serverdeploy .
This is the command I'm using to run my container
docker run -p 8080:8080 serverdeploy
This is the stack trace that I got when I run the server
where I know that I running the server
I did some research and looks like Docker had a problem with the ports when you use a Linux container in Windows (Not sure if it's already solved or not). I've already tried all the possible solutions that I found out there (even trying to replace 'localhost' by all the ip's that I get when I run ipconfig on the cmd) but I still get the same error.
And, as last hope, I need your help to understand what I'm doing wrong, or if I missing something
You are running your service bind to localhost - that means no remote connections are accepted (as well as binding to 127.0.0.1. And for your container the host is a remote connection.
Change binding to 0.0.0.0 (which I guess is default) and enjoy.
Btw sharing your java_dev_appserver.sh would be helpful for answering the question.

Can I use named pipes inside containers?

I am trying to use named pipes for inter-process communication inside a docker container but am getting "not found" errors when trying to read/write. Does docker for windows support named pipes? The software's been released and I know it works fine in VMs. I just can't find anything saying yes or no that containers on windows support named pipes.
I've got an IIS application with a named pipe binding installed inside the container along with a client application also inside the container trying to communicate via net.pipe://localhost. My run command looks like this
docker run -it -m 2GB -p 80:80 --network External company/appserver
The error message is
The pipe endpoint 'net.pipe://localhost/WCFSvc/WCF.svc' could not be
found on your local machine
You can mount named pipes into Docker containers, but this only works on Windows Server 1709 and later. I put an example in my blog post: https://blog.docker.com/2017/09/docker-windows-server-1709/
docker run -d -p 8080:8080 -v \\.\pipe\docker_engine:\\.\pipe\docker_engine friism/jenkins

Connecting with JMX using Docker for Mac

I'm struggling with setting up a JMX connection to Tomcat running in a Docker container using Docker for Mac.
I think I understand the basics, and have a setenv.sh in the tomcat/bin directory looking like this:
CATALINA_OPTS="-Dcom.sun.management.jmxremote=true\
-Dcom.sun.management.jmxremote.local.only=false\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.ssl=false\
-Djava.rmi.server.hostname=185.83.15.228\
-Dcom.sun.management.jmxremote.port=9999\
-Dcom.sun.management.jmxremote.rmi.port=9999"
I think the problematic part might be the java.rmi.server.hostname property. I've set this to the IP of the host machine, but I've also tried other obvious things. I believe this should be the IP of the machine on which jconsole or jvisualvm will be running, but this is not working for me.
I start the container like this:
docker run -d -v /Users/timbo/tomcat-jmx.sh:/usr/local/tomcat/bin/setenv.sh -p 8080:8080 -p 9999:9999 tomcat:8.0
so port 9999 is exposed.
When I try to connect using jvisualvm connecting to localhost:9999 (which Docker for Mac will route to the container which is actually on 172.17.0.2) I get the error:
Cannot connect to localhost:9999 using service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi
Any hints on what is wrong?
OK, I think I managed to find it eventually. Setting the value of java.rmi.server.hostname to the hostname of the host (e.g. mymac.local, or whatever is returned by hostname) seem to get it working. All other settings were OK.
Docker for Mac works in a bit different way. The port you map actually gets mapped to the Linux VM it is running in the background. This VM usually has in IP 192.168.99.100. So you should try and connect to 192.168.99.100:9999
To verify what is the IP of your VM, open the Docker CLI terminal and execute below
echo $DOCKER_HOST
tcp://192.168.99.100:2376

Where exactly, are files in docker container stored on the host machine

I am using docker on windows. With the use of kitematic, I have created an ubuntu container. This ubuntu image has postgresql installed on it.
Wondering if there is any possibility to access the postgres configuration files available in the container from the host (windows machine)?
Where exactly does the container store its file system on the host machine?
I hope it would be part of image file with format VMDK.
Please correct me if I'm wrong.
Wondering if there is any possibility to access the postgres configuration files available in the container from the host (windows machine)
That is not how Docker would allow you to modify a file in a container.
For that, you should mount a host (Windows) folder when starting (docker run -v) your container.
See "Mount a host directory as a data volume"
docker run -d -P --name web -v /c/Users/<myACcount>/src/webapp:/opt/webapp training/webapp python app.py
Issue 247 mentions ~/Library/Application Support/Kitematic for App data, and ~/Kitematic "for easy access to volume data".

Accessing host's host:port from Docker container in OSX

This question may be similar to other questions already answered, but I could not find any that is specific to OSX.
I'm new to Docker. I'm using Docker Version 1.12.1-beta25 (build: 11807) native support for OSX. I wanted to install a Docker Bamboo remote agent, following the instructions at https://confluence.atlassian.com/bamboo/getting-started-with-docker-and-bamboo-687213473.html. My Bamboo server is running on the host.
When running the Docker container with docker run -e HOME=/root/ -e BAMBOO_SERVER=http://hostname:port/bamboo -i -t atlassian/bamboo-java-agent:latest, it failed with Connecting to http://hostname:port/bamboo refused
The problem seems to be that the container could not access the host's http://hostname:port/bamboo. What do I need to do to get this working?
You may try to use http://172.17.0.1:port to find the host from the container. You find this address with docker inspect 'name'.
Or, you can use -p hostPort:containerPort in the docker run command and yse http://localhost:containerPort as Banboo_server

Resources