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.
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)
I am having a similar issue. The issue for me is not that the server is not responding, but that the name resolution (dns) breaks when I add a command to my service.
I don’t know if @appletea is experiencing the same problem, but ping should not be affected by whether nginx has started or not.