Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sinnbeck's avatar
Level 102

Exposing ports with lando

So after the talks yesterday at laracon I decided to give lando a shot. I am used to building my own custom docker images etc, but it looked cool.

I have almost gotten my setup working, but one thing is giving me issues. How do you expose ports on a container? I just want to open a couple of ports on the appserver, yet it is telling me the port is in use (by the lando proxy) after rebuilding

I am unsure if I am missing something in the docs, but they arent really clear I think: https://docs.lando.dev/config/services.html#localhost-assignment

name: intranet
recipe: laravel
config:
  webroot: ./public
  php: '8.0'
  via: nginx
  database: mariadb
  cache: redis
  xdebug: true
services:
  appserver:
    moreHttpPorts:
      - "3009"
    overrides:
      ports:
        - "3009:3009"

I have also tried this but it seems that is for when the service exposes just one port? Not quite sure.. https://docs.lando.dev/guides/external-access.html#locking-down-ports

name: intranet
recipe: laravel
config:
  webroot: ./public
  php: '8.0'
  via: nginx
  database: mariadb
  cache: redis
  xdebug: true
services:
  appserver:
    portforward: 3309
0 likes
3 replies
esorone's avatar

Hey Sinnbeck,

Not sure if this would help (not familiar with Lando) . But did you try something like

docker run -d -p 3309 --name intranet. ?

Might help.

Kr

Sinnbeck's avatar
Level 102

@esorone I can easily get it working using docker directly (or docker compose). But with Lando it almost seem like an afterthought (they seem to force you into using proxies)

Sinnbeck's avatar
Sinnbeck
OP
Best Answer
Level 102

I decided to try and make a dedicated node container instead.. And that worked.. Not sure why it doesnt on the appserver service

services:
  node:
    type: node:16
    ports:
      - 3009:3009
    build:
      - npm install

Please or to participate in this conversation.