#docker (2021-10)


All things docker

Archive: https://archive.sweetops.com/docker/


sheldonh avatar

Why would docker-compose work but not docker compose when I’m running one on Ubuntu 18.04 and one on Mac with docker desktop and docker version on both is 20.9+

Tried experimental flag on Ubuntu for kicks and still no go.

sheldonh avatar

thank you, that helped a ton. couldn’t find anything on this terminology. Just setup update for ubuntu desktop to pull in v2 as update and will be good to go.


Saichovsky avatar

I am using an Amazom AMI image to build spot instances whenever there is a build job. One of the packages that is created is docker using the commands below:

# Install Docker CE
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | apt-key add -
add-apt-repository \
   "deb [arch=amd64] <https://download.docker.com/linux/ubuntu> \
   $(lsb_release -cs) \

apt-get update -yq && apt-get -yq install docker-ce docker-ce-cli containerd.io

Sometimes, my internal routing table for the instance looks like this:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    100    0        0 ens5   U     0      0        0 ens5 UH    100    0        0 ens5     U     0      0        0 docker0     U     0      0        0 br-77455fcf0cbe     U     0      0        0 br-41e09bcc0b9c   U     0      0        0 br-c80695bea2be   U     0      0        0 br-5d6cf359313a   U     0      0        0 br-f38334a832ee   U     0      0        0 br-41a02bc22363   U     0      0        0 br-1f45ae76c3fe   U     0      0        0 br-8a8bb9ab22a0   U     0      0        0 br-c7f72974b999

And sometimes I have a smaller routing table (some of the subnets listed above are excluded). I am not sure what the reason is for the inconsistent routing tables and bridged network interfaces, but it’s causing me some trouble, because every once in a while, a job needs to access an IP in one of the listed subnets in the routing table, which gets created by docker. In other words, docker sometimes creates a routing table that overrides the default route, causing builds to fail for a particular service, where the build script needs to access an IP address in one of the listed subnets. The traffic gets routed to one of those docker interfaces and times out.

Now my question is, what can be done about this? I just tried to have a look at /etc/docker/daemon.json to see what’s in there and the file is actually missing. How do I deal with this erratic behaviour by dockerd?

Oscar avatar

Has someone here tried to access a service running in a container from another container, both running in the same host? In my case, I have a DB running on a compose with the port published to the host. Then I am running a gitlab-runner container, which needs to access this database to keep the test local. It works if I point to the DB in AWS RDS. I have tried to point to the local using its IP, container name, I also tried running the second container with –net <compose network> and tried the same as mentioned before. Any ideas?

Saichovsky avatar

What does your compose file look like?

Oscar avatar

Saichovsky, thank you for responding. this looks like a problem with the gitlab-runner image. I was able to query from a centos image after downloading postgresql. the compose file looks like this:

version: '3.7'
        container_name: postgres
        image: postgres:12.7
        restart: always
            - env/postgres.env
                max-size: 10m
                max-file: "3"
            - '5432:5432'
            - database
            - "postgres_data:/var/lib/postgresql/data"
Oscar avatar

I believe I know what is happening. the gitlab runner is creating a new container. that one is the one that needs to be connected to the db network

Oscar avatar

so the solution was to pass the name of the network after the argument –docker-network-mode for the gitlab-runner command