Start container with multiple network interfaces

With Docker 1.12+ it’s possible to add more than one network interface to a docker container with about five lines of shell commands. First: you must create the Docker networks network1 and network2 via docker network create shell command: docker network create –driver=bridge network1 –subnet=172.19.0.0/24 docker network create –driver=bridge network2 –subnet=172.19.1.0/24 notes: in this example … Read more

Restrict Internet Access – Docker Container

As found here, I got this to work with docker-compose. Save as docker-compose.yml: version: ‘3’ services: outgoing-wont-work: image: alpine networks: – no-internet command: ping -c 3 google.com # will crash internal-will-work: image: alpine networks: – no-internet command: ping -c 3 internal-and-external internal-and-external: image: alpine networks: – no-internet – internet command: ping -c 3 google.com networks: … Read more

How make openvpn work with docker

Solution (TL;DR;) Create /etc/openvpn/fix-routes.sh script with following contents: #!/bin/sh echo “Adding default route to $route_vpn_gateway with /0 mask…” ip route add default via $route_vpn_gateway echo “Removing /1 routes…” ip route del 0.0.0.0/1 via $route_vpn_gateway ip route del 128.0.0.0/1 via $route_vpn_gateway Add executable bit to the file: chmod o+x /etc/openvpn/fix-routes.sh. Change owner of this file to … Read more

What does –net=host option in Docker command really do?

After the docker installation you have 3 networks by default: docker network ls NETWORK ID NAME DRIVER SCOPE f3be8b1ef7ce bridge bridge local fbff927877c1 host host local 023bb5940080 none null local I’m trying to keep this simple. So if you start a container by default it will be created inside the bridge (docker0) network. $ docker … Read more

Docker Networking Disabled: WARNING: IPv4 forwarding is disabled. Networking will not work

I reviewed http://chrisgilmerproj.github.io/ubuntu/network/docker/2013/09/05/ipv4-forwarding-and-docker.html and it helped me solving the problem on the host. I added the following to /etc/sysctl.conf: net.ipv4.ip_forward=1 I then restarted the network service and validated the setting: [root@pprdespap322 deploy]# systemctl restart network [root@pprdespap322 deploy]# sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 1 [root@pprdespap322 deploy]# docker run -ti quay.io/coreos/registry ping ci.docker.company.net PING pprdespap324.corp.company.net (10.137.55.22) 56(84) bytes … Read more

From inside of a Docker container, how do I connect to the localhost of the machine?

Edit: If you are using Docker-for-mac or Docker-for-Windows 18.03+, just connect to your mysql service using the host host.docker.internal (instead of the 127.0.0.1 in your connection string). If you are using Docker-for-Linux 20.10.0+, you can also use the host host.docker.internal if you started your Docker container with the –add-host host.docker.internal:host-gateway option. Otherwise, read below TLDR … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)