Local compose error when external network not available

Signed-off-by: Guillame Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillame Tardif 2020-11-30 11:33:30 +01:00
parent ab41285a07
commit d24ffd97a0
1 changed files with 4 additions and 0 deletions

View File

@ -558,6 +558,10 @@ func (s *composeService) ensureNetwork(ctx context.Context, n types.NetworkConfi
_, err := s.apiClient.NetworkInspect(ctx, n.Name, moby.NetworkInspectOptions{})
if err != nil {
if errdefs.IsNotFound(err) {
if n.External.External {
return fmt.Errorf("Network %s declared as external, but could not be found", n.Name)
}
createOpts := moby.NetworkCreate{
// TODO NameSpace Labels
Labels: n.Labels,