Command entry in detached step breaks service

I don’t know if this is intended or a bug, but detached steps are not able to have commands, otherwise service is not accessible by other steps. At very least this should be mentioned in documentation, along where detaching is described.

Is this a bug?

detached steps are able to have commands. I created a live example that you can reference.

Here is the yaml:
https://github.com/drone/hello-world/blob/e129ea553a176b61a9f9fc38c10d7e45e10d5255/.drone.yml

Here is the corresponding pipeline execution:
https://cloud.drone.io/drone/hello-world/272/1/2

No, I meant if commands are run, the service is not reachable, messes with network

With command, service in step is not reachable:

kind: pipeline
type: docker
name: default

steps:
  - name: web
    image: nginx:alpine
    detach: true
    commands:
    - echo foo

  - name: test
    image: alpine:3
    commands:
    - sleep 5
    - ping web

If we comment out command, it becomes reachable:

kind: pipeline
type: docker
name: default

steps:
  - name: web
    image: nginx:alpine
    detach: true
#    commands:
#    - echo foo

  - name: test
    image: alpine:3
    commands:
    - sleep 5
    - ping web

When you use the commands section it overrides the default container entrypoint with your shell commands (see docs.drone.io/pipeline/docker/syntax/steps/#commands). This means that, in your example, nginx is not going to automatically start because the entrypoint (which launches nginx) is being overridden. This can be solved by starting nginx from the commands section.

kind: pipeline
type: docker
name: default

steps:
  - name: web
    image: nginx:alpine
    detach: true
    commands:
    - /docker-entrypoint.sh nginx -g daemon off

  - name: test
    image: alpine:3
    commands:
    - sleep 5
    - ping web

(the above example replicates the docker entrypoint as defined in the Dockerfile. I did not test the above command so you may need to adjust to get it working)