Comments (4)
Possibly related issue: moby/moby#33661
from libcompose.
@vdemeester what will it take to get this fixed? updating docker vendor to moby?
I just noticed this issue and I saw that if I use two networks the 2nd one works (as long as the 2nd one is not the default).
---
version: '2'
services:
test.env:
container_name: test.env
image: alpine
environment:
FOO: ${ABC:-foo}
command: env
networks:
default:
aliases:
- does.not.work
notdefault:
aliases:
- works
Which brought me to another question. How do you create an alias for an external network in docker-compose v2??
You can't duplicate keys so this won't work
---
version: '2'
services:
test.env:
container_name: test.env
image: alpine
environment:
FOO: ${ABC:-foo}
command: env
networks:
- something:
networks:
something:
aliases:
- dunno
networks:
something:
external: true
from libcompose.
@vdemeester I have a "hack" that I was able to implement to get aliases working (at least for my project).
./vendor/github.com/docker/libcompose/docker/service/service.go
+ if len(net.Aliases) >= 1 {
+ client.NetworkConnect(ctx, net.RealName, containerID, &network.EndpointSettings{
+ Aliases: aliases,
+ Links: links,
+ IPAddress: net.IPv4Address,
+ IPAMConfig: &network.EndpointIPAMConfig{
+ IPv4Address: net.IPv4Address,
+ IPv6Address: net.IPv6Address,
+ },
+ })
+ client.NetworkDisconnect(ctx, net.RealName, containerID, true)
+ }
essentially reconnect quickly to the network to trick the docker client into creating the alias.
from libcompose.
I will make a PR with this so it's easier to see the change
from libcompose.
Related Issues (20)
- Could not parse config for project which was created by the same lib HOT 1
- libcompose library ignoring set log levels HOT 3
- Issue with env_file population. HOT 2
- compose version: "2.0" HOT 1
- Lowercase sirupsen/logrus package import HOT 3
- compose Up fails trying to recreate containers when not needed HOT 6
- 'hack' contains two packages in the same directory - breaking some tools HOT 1
- Question: How to use Up() without detached? HOT 4
- No image or build context specified error when using override file
- Build fails on a fresh checkout HOT 6
- Is this project dead?
- Volume driver reports as "changed" on second "libcompose up" attempt HOT 3
- Creating a network is slow
- Tie the docker events api into libcompose events
- docker compose file fails with libcompose passes with docker-compose CLI HOT 2
- libcompose differentiating between version 2 and version 2.0
- libcompose fails to create networks for version "2.0" and above
- libcompose build broken HOT 2
- Jenkins marking tests successful when they fail? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcompose.