Start initiates docker-compose up
()
| 1487 | |
| 1488 | // Start initiates docker-compose up |
| 1489 | func (app *DdevApp) Start() error { |
| 1490 | var err error |
| 1491 | if app.IsMutagenEnabled() && globalconfig.DdevGlobalConfig.UseHardenedImages { |
| 1492 | return fmt.Errorf("mutagen is not compatible with use-hardened-images") |
| 1493 | } |
| 1494 | |
| 1495 | if dockerutil.IsDockerRootless() && !globalconfig.DdevGlobalConfig.NoBindMounts { |
| 1496 | // See https://github.com/moby/moby/issues/45919 |
| 1497 | // See https://github.com/moby/moby/issues/2259 |
| 1498 | return fmt.Errorf("bind mounts can't be used with Docker Rootless.\nRun `ddev config global --no-bind-mounts` and try again") |
| 1499 | } |
| 1500 | |
| 1501 | if err := globalconfig.CheckForMultipleGlobalDdevDirs(); err != nil { |
| 1502 | util.WarningOnce("Warning: %v", err) |
| 1503 | } |
| 1504 | |
| 1505 | if !globalconfig.IsInternetActive() && globalconfig.DdevDebug { |
| 1506 | util.WarningOnce("Internet connection not detected, DNS may not work.\nWarning: %v\nSee https://docs.ddev.com/en/stable/users/usage/offline/ for info.", globalconfig.IsInternetActiveErr) |
| 1507 | } |
| 1508 | |
| 1509 | // We don't yet know the ComposeYaml values, so make sure they're |
| 1510 | // not set. |
| 1511 | app.ComposeYaml = nil |
| 1512 | |
| 1513 | // Set up ports to be replaced with ephemeral ports if needed |
| 1514 | app.RouterHTTPPort = app.GetPrimaryRouterHTTPPort() |
| 1515 | app.RouterHTTPSPort = app.GetPrimaryRouterHTTPSPort() |
| 1516 | app.MailpitHTTPPort = app.GetMailpitHTTPPort() |
| 1517 | app.MailpitHTTPSPort = app.GetMailpitHTTPSPort() |
| 1518 | app.XHGuiHTTPPort = app.GetXHGuiHTTPPort() |
| 1519 | app.XHGuiHTTPSPort = app.GetXHGuiHTTPSPort() |
| 1520 | |
| 1521 | AssignRouterPortsToGenericWebserverPorts(app) |
| 1522 | |
| 1523 | portsToCheck := []*string{&app.RouterHTTPPort, &app.RouterHTTPSPort, &app.MailpitHTTPPort, &app.MailpitHTTPSPort, &app.XHGuiHTTPPort, &app.XHGuiHTTPSPort} |
| 1524 | GetEphemeralPortsIfNeeded(portsToCheck, true) |
| 1525 | |
| 1526 | SyncGenericWebserverPortsWithRouterPorts(app) |
| 1527 | |
| 1528 | _ = app.DockerEnv() |
| 1529 | dockerutil.EnsureDdevNetwork() |
| 1530 | // The project network may have duplicates, we can remove them here. |
| 1531 | // See https://github.com/ddev/ddev/pull/5508 |
| 1532 | dockerutil.RemoveNetworkDuplicates(app.GetDefaultNetworkName()) |
| 1533 | |
| 1534 | if err = dockerutil.CheckDockerCompose(); err != nil { |
| 1535 | if os.IsTimeout(err) || strings.Contains(err.Error(), "timeout") { |
| 1536 | util.Failed(`Failed to download updated docker-compose binary. |
| 1537 | This might be due to network issues or a slow response. |
| 1538 | Please ensure your network is stable and try again: |
| 1539 | %v`, err) |
| 1540 | } else { |
| 1541 | util.Failed(`DDEV's private docker-compose binary does not exist or is set to an invalid version. |
| 1542 | Please use DDEV's' built-in docker-compose. |
| 1543 | Fix with 'ddev config global --required-docker-compose-version="" --use-docker-compose-from-path=false': %v`, err) |
| 1544 | } |
| 1545 | } |
| 1546 |