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

Container fails to start if port already in use #30

Open
jacobtomlinson opened this issue Jul 6, 2022 · 1 comment · May be fixed by #42
Open

Container fails to start if port already in use #30

jacobtomlinson opened this issue Jul 6, 2022 · 1 comment · May be fixed by #42
Labels
bug Something isn't working

Comments

@jacobtomlinson
Copy link
Member

jacobtomlinson commented Jul 6, 2022

If canary tries to expose a container port for testing and that port is already in use the container fails to start and canary fails to validate.

Works

# check-port.yaml
apiVersion: container-canary.nvidia.com/v1
kind: Validator
name: check-port
description: Check port
env: []
ports:
  - port: 80
    protocol: TCP
volumes: []
checks:
  - name: http
    description: Check port 80
    probe:
      httpGet:
        path: /
        port: 80
      failureThreshold: 30
$ canary validate --file check-port.yaml nginx
Validating nginx against check-port
 Check port 80                                      [passed]
validation passed

Reproducer

$ docker run -p 80:80 nginx  # Start a process that binds to port 80 in another terminal
$ canary validate --file /tmp/test.yaml nginx
Validating nginx against check-port
\ Starting container
Error: container failed to start after 10 seconds

The container also doesn't get cleaned up.

$ docker ps -a             
CONTAINER ID   IMAGE                                  COMMAND                  CREATED         STATUS         PORTS                               NAMES
e8d32b8f45aa   nginx                                  "/docker-entrypoint.…"   2 minutes ago   Created                                            canary-runner-d43137e8
@jacobtomlinson jacobtomlinson added the bug Something isn't working label Jul 6, 2022
@jacobtomlinson
Copy link
Member Author

In #35 we added cleanup so the container isn't left after. However, things still fail to start.

Ideally canary would bind the container port to a random high port and then run the tests on that port.

@fedeztk fedeztk linked a pull request Jun 3, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant