I have a simple yaml file which starts two containers: JBoss and Postgres. When I run:
docker-compose -f compose-application.yaml up -d
new network is created - this is what I expect. However, when I stop containers with:
docker-compose -f compose-application.yaml down
and start them once again then network gets new subnet (increased by 1). When restart is repeated few times then subnet assigned conflicts with already existing one (problem with routing etc.).
I know I can specify subnet which should be used inside yaml. However, I tried to run this on different machine (Docker for Windows 7) and there this network gets the same subnet each time.
I am using docker version:
docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:03 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:25:29 2018
OS/Arch: linux/amd64
Experimental: false
and docker compose:
docker-compose version
docker-compose version 1.23.1, build b02f1306
docker-py version: 3.5.0
CPython version: 3.6.7
OpenSSL version: OpenSSL 1.1.0f 25 May 2017
I don't know why it works differently in Windows 7, but I can imagine that's because Docker machine itself.
I think the best solution it's really define a network on docker-compose yml file. Something like this:
networks:
network_name:
name: NETWORK_NAME
driver: bridge
ipam:
config:
- subnet: SUBNET
Related
I'm using a Windows-Image container with a transparent network driver:
Host SO: Windows 10 Pro
Container Image:
mcr.microsoft.com/dotnet/sdk:5.0-windowsservercore-ltsc2019
C:\>docker version
Client:
Cloud integration: v1.0.22
Version: 20.10.13
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 10 14:13:04 2022
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Desktop 4.6.0 (75818)
Engine:
Version: 20.10.13
API version: 1.41 (minimum version 1.24)
Go version: go1.16.15
Git commit: 906f57f
Built: Thu Mar 10 14:08:21 2022
OS/Arch: windows/amd64
Experimental: true
Network used:
docker network create --driver transparent -o com.docker.network.windowsshim.interface="Ethernet 7" --subnet 10.61.1.0/24 --gateway 10.61.1.254 MY_NETWORK
Command to run the container:
docker run --net MY_NETWORK --ip 10.61.1.120 --add-host=host.docker.internal:host-gateway -it --name TEST_1 testimage cmd.exe
I can ping the host from within the container and viceversa.
But when I try to call a service runnig on the host, the 'host.docker.internal' is not resolved:
The host file in the host machine (10.61.1.102) is:
I have installed docker on my local machine using the following command
docker run -d --name some-rabbit -p 5672:5672 -p 5673:5673 -p 15672:15672 rabbitmq:3-management
I have no issues with the installation and I am able to access rabbitmq management console on my local machine using localhost and ip address
http://localhost:15672/ OR
http://192.168.1.111:15672/#/
Both of these URLs are working fine on the machine where RabbitMQ is installed.
Now, I want to access this management console from some other machine ( IP address 192.168.1.116) which is in the same network.
When I tried to access management console using IP (192.168.1.111) address I am getting following error:-
This site can't be reached. 192.168.1.111 took too long to respond. Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_TIMED_OUT
I have verified that machine is reachable and I was able to ping 192.168.1.111 (machine where RabbitMQ is installed through docker) from 192.168.1.116
Below are details of docker installation
C:\Users\heman>docker version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:43:18 2020
OS/Arch: windows/amd64
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:49:27 2020
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
Kubernetes:
Version: v1.16.6-beta.0
StackAPI: v1alpha3
I am using docker compose as follows:
version: '3.7'
services:
couchdb:
image: "ibmcom/couchdb3:preview"
container_name: couch-api-test
ports:
- "5984:5984"
and here is my docker version:
+ docker version
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:10:01 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:08:31 2018
OS/Arch: linux/amd64
Experimental: false
and my docker-compose version is:
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
When I run my docker-compose in my ubuntu 16 server I get this:
client version 1.38 is too new. Maximum supported API version is 1.37", "stderr_lines": ["client version 1.38 is too new. Maximum supported API version is 1.37"
Can anyone shed light on it?
API calls made by the docker-compose client are versioned to ensure that clients don't break. For example to create a container it makes a POST to:
/v1.36/containers/create?name=...
The API version used for the calls is based on the version directive in the docker-compose.yml file. I couldn't find in the documentation the correspondence between the docker-compose file format and the API but I assume for version 3.7 the API version is 1.38.
The 18.03.0-ce docker engine release is compatible with compose file format up to 3.6 and API version 1.37 according to this compatibility matrix:
Compose file versions and upgrading
The problem is that the docker-compose client is newer than the engine and it understands the 3.7 format but this format is incompatible with the engine. To make things work use
version: '3.6' or update the engine to version 18.06.0+
Hope this helps.
I cannot connect to a service running on docker swarm. The swarm seems ok because I can connect to other containers running on it. I running the service with docker stack deploy -c docker-compose.yaml nifi and the docker compose file is:
version: "3.3"
services:
registry:
image: apache/nifi-registry:0.3.0
ports:
- "18080:18080"
deploy:
replicas: 1
restart_policy:
condition: on-failure
When I run this without the swarm i.e. docker-compose -f docker-compose.yaml up it works fine and I can browse to it. When I run it with docker stack deploy -c docker-compose.yaml nifi I see the same log entries for the service but cannot browse to it.
$ docker version
Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Wed Jun 20 21:43:51 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Wed Jun 20 21:42:00 2018
OS/Arch: linux/amd64
Experimental: false
Does anyone have suggestions for fixing or troubleshooting this?
In swarm
ports:
- "18080:18080"
will expose port on all swarm nodes and in case of use of the port on some of the nodes by another service you can have problems
you can expose port only on host with container
services:
registry:
ports:
- target: 18080
published: 18080
mode: host
I am using docker stack to deploy some services on a swarm network with two nodes . I created overlay network which I can see through
docker network ls but when I am trying to use that network in docker stack file I am continuously getting error Network undefined .
Here is my docker stack file
version: '3.4'
services:
orderer1st:
image: hyperledger/fabric-orderer:1.2.1
networks:
- fabricoverlay
ports:
- 7050:7050
environment:
- ORDERER_GENERAL_LOGLEVEL=info
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
command: orderer
volumes:
- ./channel-configuration/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./msp:/var/hyperledger/orderer/msp
Am I doing something wrong here? I dont know why docker stack is been unable to pick overlay network
Docker Version:
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:56 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:21 2018
OS/Arch: linux/amd64
Experimental: false
You have to add the networks as root objects in the compose file so the service knows how to find it.
networks:
fabricoverlay:
external: true
Note that an easier option might be letting swarm create that network for your stack. Just remove the network references in the compose file, delete the manually created network, and deploy the stack. Docker will create it for you, one network per stack.