Skip to main content
The 2024 Developer Survey results are live! See the results
edited body
Source Link
Peter
  • 1.1k
  • 2
  • 17
  • 34

I have a windows 10 host, using docker desktop 4.6.01. I have a docker-compose.yml which contains the two services vpn and app. What I want to achieve is, that the build process of docker already uses the vpn containers network connection.

version: "3.8"
services:
  vpn:
    ...
  app:
    ...
    network_mode: service:vpn

The app container itself correctly uses the vpn container connection, as I could verify this by testing. But the build process seems to use the hosts network. Dockers build command has a network or networkmode argument that allows to use a specific containers network. But it gives me an error:

docker-compose.yml

version: "3.8"
services:
  vpn:
    ...
  app:
    build:
      network: container:vpn
    network_mode: service:vpn

docker compose up -d

network mode "container:vpn" not supported by buildkit. You can define a custom network for your builder using the network driver-opt in buildx create.

How would I use buildx in my example? I am quite confused by the documentation which talks about context and endpoints.

I have a windows 10 host, using docker desktop 4.6.0. I have a docker-compose.yml which contains the two services vpn and app. What I want to achieve is, that the build process of docker already uses the vpn containers network connection.

version: "3.8"
services:
  vpn:
    ...
  app:
    ...
    network_mode: service:vpn

The app container itself correctly uses the vpn container connection, as I could verify this by testing. But the build process seems to use the hosts network. Dockers build command has a network or networkmode argument that allows to use a specific containers network. But it gives me an error:

docker-compose.yml

version: "3.8"
services:
  vpn:
    ...
  app:
    build:
      network: container:vpn
    network_mode: service:vpn

docker compose up -d

network mode "container:vpn" not supported by buildkit. You can define a custom network for your builder using the network driver-opt in buildx create.

How would I use buildx in my example? I am quite confused by the documentation which talks about context and endpoints.

I have a windows 10 host, using docker desktop 4.6.1. I have a docker-compose.yml which contains the two services vpn and app. What I want to achieve is, that the build process of docker already uses the vpn containers network connection.

version: "3.8"
services:
  vpn:
    ...
  app:
    ...
    network_mode: service:vpn

The app container itself correctly uses the vpn container connection, as I could verify this by testing. But the build process seems to use the hosts network. Dockers build command has a network or networkmode argument that allows to use a specific containers network. But it gives me an error:

docker-compose.yml

version: "3.8"
services:
  vpn:
    ...
  app:
    build:
      network: container:vpn
    network_mode: service:vpn

docker compose up -d

network mode "container:vpn" not supported by buildkit. You can define a custom network for your builder using the network driver-opt in buildx create.

How would I use buildx in my example? I am quite confused by the documentation which talks about context and endpoints.

Source Link
Peter
  • 1.1k
  • 2
  • 17
  • 34

docker build - use a containers network

I have a windows 10 host, using docker desktop 4.6.0. I have a docker-compose.yml which contains the two services vpn and app. What I want to achieve is, that the build process of docker already uses the vpn containers network connection.

version: "3.8"
services:
  vpn:
    ...
  app:
    ...
    network_mode: service:vpn

The app container itself correctly uses the vpn container connection, as I could verify this by testing. But the build process seems to use the hosts network. Dockers build command has a network or networkmode argument that allows to use a specific containers network. But it gives me an error:

docker-compose.yml

version: "3.8"
services:
  vpn:
    ...
  app:
    build:
      network: container:vpn
    network_mode: service:vpn

docker compose up -d

network mode "container:vpn" not supported by buildkit. You can define a custom network for your builder using the network driver-opt in buildx create.

How would I use buildx in my example? I am quite confused by the documentation which talks about context and endpoints.