Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#244: Variable for setting the network limit. #245

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/config/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ You can also use the environment variable `LANDO_HOST_IP`.
```sh
lando exec my-service -- ping "\$LANDO_HOST_IP" -c 3
```

## Network Limits

By default Docker has a limit of 32 networks. If you're running a large number of sites, you'll see a message `Lando has detected you are at Docker's network limit`, after which Lando will attempt to clean up unused networks to put you below the network limit.

If you've [modified your Docker daemon](https://discussion.fedoraproject.org/t/increase-limit-of-30-docker-networks-in-a-clean-way/96622/4) to allow more networks, you can set Lando's network limit to a higher number by setting the `networkLimit` variable in [Lando's global config](./global.html).
7 changes: 7 additions & 0 deletions examples/networking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ cp -rf index.php lemp/index.php
cp -rf nginx.conf lemp/nginx.conf
cp -rf .lando.lemp.yml lemp/.lando.yml
cd lemp && lando start

# Should copy .config.yml to ~/.lando/config.yml
cp config.yml ~/.lando/config.yml
lando --clear
```

## Verification commands
Expand Down Expand Up @@ -63,6 +67,9 @@ lando exec appserver_nginx -- curl https://appserver.landolamp.internal
# Should even be able to connect to a database in a different app
cd lamp
lando exec database -- mysql -uroot -h database.landolemp.internal -e "quit"

# Should see the correct network limit
lando config | grep "networkLimit: 64"
```

## Destroy tests
Expand Down
1 change: 1 addition & 0 deletions examples/networking/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
networkLimit: 64
2 changes: 1 addition & 1 deletion plugins/networking/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const getDockerDesktopBin = require('../../utils/get-docker-desktop-x');
*/
const cleanNetworks = lando => lando.engine.getNetworks()
.then(networks => {
if (_.size(networks) >= 32) {
if (_.size(networks) >= lando.config.networkLimit) {
// Warn user about this action
lando.log.warn('Lando has detected you are at Docker\'s network limit!');
lando.log.warn('Give us a moment as we try to make space by cleaning up old networks...');
Expand Down
1 change: 1 addition & 0 deletions utils/get-config-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const defaultConfig = options => ({
home: os.homedir(),
isArmed: _.includes(['arm64', 'aarch64'], process.arch),
logLevel: 'debug',
networkLimit: 32,
node: process.version,
os: {
type: os.type(),
Expand Down
Loading