[go: nahoru, domu]

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

Couldn't inspect container: Error: No such container: 7a17d97ad... #32

Closed
shinebayar-g opened this issue Nov 2, 2021 · 2 comments
Closed
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@shinebayar-g
Copy link
Owner

I'm getting this error whenever I try to remove 3+ containers at the same time using docker rm -f container_1 container_2 container_3 syntax. Somehow only 2 of the container's firewall rule is deleted and 3rd container errors with no such container error...

Right now it looks like it's consistent behavior, easily reproducible. I cannot find the cause at the moment..
So until this issue is fixed, please don't remove 3+ containers at the same time 🤦‍♂️

@shinebayar-g shinebayar-g added bug Something isn't working help wanted Extra attention is needed labels Nov 2, 2021
@shinebayar-g
Copy link
Owner Author

Another error when stopping 3+ containers:

ufw-docker-automated: Deleting rule: /usr/bin/sudo ufw route delete deny from 172.17.0.5 to any comment upbeat_antonelli:7e9a1537a501
ufw: Rule deleted

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0x7b849c]

goroutine 23 [running]:
main.handleUfwRule(0xc000082660)
        /home/ubuntu/ufw-docker-automated/main.go:50 +0x13c
created by main.main
        /home/ubuntu/ufw-docker-automated/main.go:238 +0xb4

@shinebayar-g
Copy link
Owner Author

Found the reason. On this line I'm trying to reference container's IP address from *types.NetworkSettings field. But it's returning empty string when I turn off multiple containers at once. I guess this IPAddress field is trying to get the IP address after container is already detached from the network, hence IPAddress is empty.
Since ContainerIP variable is emptry next if condition gets triggered and program crashes because of unsafe map access.

Ultimately this reveals the bigger problem that I cannot get the IPAddress reference before container shuts down. I need to store the container IP address somewhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant