-
Notifications
You must be signed in to change notification settings - Fork 102
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
Timing out starting container #222
Comments
Unable to reproduce with plain
CLI Output:
Ansible playbook: - hosts: all
vars:
ansible_python_interpreter: "/usr/local/bin/python3-docker"
tasks:
- name: (suitecrm) The latest suitecrm service is built
docker_compose:
project_name: suitecrm_test
definition:
version: '3.6'
services:
suitecrm_test:
image: "bitnami/suitecrm:7-debian-10"
container_name: suitecrm_test
networks:
- backend
environment:
SUITECRM_HOST: 'oc1733.ourcompose.com'
SUITECRM_DATABASE_HOST: "database"
SUITECRM_DATABASE_NAME: 'suitecrm'
SUITECRM_DATABASE_USER: 'suitecrm'
SUITECRM_DATABASE_PASSWORD: "ELuyJrgdQ7TcSIk5"
SUITECRM_SERVER_URL: "https://oc1733.ourcompose.com/suitecrm"
SUITECRM_USERNAME: 'admin'
SUITECRM_PASSWORD: 'testpassword'
networks:
backend:
external: true
pull: yes
state: present
restarted: yes Systemd Journal output:
As you can see, 12 seconds after the command was logged, the starting/running container was terminated. |
My guess is that the timeout is being applied because an existing container is being restarted whereas when you ran through CLI it looked like a fresh container. |
I was hoping that was the case too, but this happens on the server that's being started. See the output (emphasis added):
Additionally, I tried a timeout of 200 seconds, and got the following:
So even with a 200 second timeout ( |
It looks like it's doing it to other containers too... Using the official mariadb server as an example:
Shutdown existing mariadb server: (note container id:
Startup of new Mariadb container (Note the new container id:
And here we see the same force kill by dockerd of that started container id:
I did some more testing with the manual It seems that somehow, the |
I just gunna confirm really quick here that my initial issue with suitecrm is solved with a workaround of setting the timeout to 200. This allows the initialization to complete before restarting the container. Previously this wasn't allowed to happen (the container was killed in the middle of the initialization script) and left the container in a broken state. I am definitely interested in unraveling this issue however. I suspect this is applicable to any docker_compose task that has |
Can you provide the following? Basically this Ansible module only calls the compose restart command which invokes the |
Here's what I performed on a Ubuntu 20.04 server: # curl -fsSL https://get.docker.com -o get-docker.sh
# bash ./get-docker.sh
# apt install python3-pip
# pip3 install docker docker-compose ansible
# cat <<EOF > mariadb_test.yml
- hosts: all
vars:
ansible_python_interpreter: '/usr/bin/env python3'
tasks:
- name: (mariadb) The latest mariadb service is built and present
docker_compose:
project_name: mariadb
timeout: 60
definition:
version: '3.6'
services:
mariadb:
image: "mariadb:10.5"
container_name: database
restart: always
volumes:
- "/srv/local/database_mysql:/var/lib/mysql"
- "/srv/local/database_conf.d:/etc/mysql/conf.d"
networks:
- backend
environment:
MYSQL_ROOT_PASSWORD: "testpassword"
networks:
backend:
name: backend
pull: yes
state: present
restarted: yes
EOF
# ansible-playbook -i localhost, -c local mariadb_test.yml
# journalctl -xe --since "3 minutes ago" | grep "failed to exit" With the above, I'm able to able to get it to time out during the first deploy, but not during the restart. Any time the container is stopped, this timeout happens. I'll take a look at my local env to see if there's anything different there. |
I'm still looking into possible reasons why even on a restart this would happen, but at very least changing This is infinitely reproducable using the following:
With literally any container. |
I tried to get fancy:
I don't know whether to be frustrated or burst out into laughter. |
So, it seems like Notice how it errors out on
And the rest of the startup proceeds from there. So perhaps this is more of a proposition to be more intelligent about the
|
Continued from the following issues:
This is happening again with https://hub.docker.com/r/bitnami/suitecrm.
Specifically the line here:
I can't find where the actual run command is from here: https://github.com/ansible-collections/community.docker/blob/main/plugins/modules/docker_compose.py#L832
Where is this
up()
function? Probably here: https://github.com/docker/compose/blob/5becea4ca9f68875334c92f191a13482bcd6e5cf/compose/cli/command.py#L36-L71, or, at least, that is theself.project
that is referenced in the above. But there doesn't seem to be anup()
function associated?I'm ultimately trying to figure out how that timeout works, since it is NOT a docker-compose native function.
EDIT: TL;DR
Also, I would have thought that the timeout as described here, why is this getting applied to a starting container? Wouldn't a timeout only be relevant for a stopping container?
The text was updated successfully, but these errors were encountered: