Container ... is not defined on lxc-attach

Hi CircleCI,

I am using 1.0 version, and while I ran docker-compose up inside the build, but cannot be lxc-attach.
It’s only happens today, I have tried with ssh-debug and same error happens.
Is there updates / patch on the lxc-attach or system tools? Just my high level guess.

Thanks!

Example of circle.yml

...
    - sudo -u root sh -c 'curl -L "https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose'
    - TAG=ci docker-compose -f ci.yml up -d:
        pwd: /xxx/xx/x/x/x
    - sudo lxc-attach -n "$(docker inspect --format "{{.Id}}" my_container)" -- bash -c "..."
...

Error message:

Error: container ... is not defined

Build reference: https://circleci.com/gh/TinkLabs/backend2/11977

I just wanted to confirm the problem here.

It has happened during this night. The same build has worked well and then the error has occured:

Error: container ... is not defined

lxc-ls sees the container we want to start. But it it impossible to attach it.

Same issue here, this is clobbering all our builds now:

Command is:
docker inspect --format '{{.Id}}' `docker ps | awk '/[0-9][a-b]*/{print $1}'` && docker ps && sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' `docker ps | awk '/[0-9][a-b]*/{print $1}'`)" -- bash -c '/some/command'

Output is:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
aa8f98b6f714        careplannertest     "/usr/sbin/apache2ctl"   17 seconds ago      Up 15 seconds                           grave_perlman
Error: container aa8f98b6f714dd5e5fb1aa3f515d064410fdd885479edf514e490a08ce7bd664 is not defined```

Hi CircleCI team,

The same problem we have. Can you please update the topic and let us know, when would this issue be solved.

Thank You.

Same issue here, using version 1.0.

I’m having to project that are running the same command, in one of them it finds the container while in the second one it is not defined.

Error: container xxx is not defined

I had same issue and I found a workaround that is adding -f option

CID=$(docker inspect --format "{{.Id}}" my_container)
sudo lxc-attach -n $CID -f /var/lib/docker/containers/$CID/config.lxc -- bash -c "..."
4 Likes

Thanks @hasimo, I replaced with

    - sudo -u root sh -c 'curl -L "https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose'
    - TAG=ci docker-compose -f ci.yml up -d:
        pwd: /xxx/xx/x/x/x
    - CID=$(docker inspect --format "{{.Id}}" my_container) &&
      sudo lxc-attach -n ${CID}  -f /var/lib/docker/containers/${CID}/config.lxc -- bash -c "..."

Are you guys all using Ubuntu? I got the same problem and it seems that Ubuntu archived many of the packages today so “apt” stopped working for a lot of stuff - hence builds fail.

Oh you are right, this helped :slight_smile: I wonder what happened at Circle CI?

Yes it worked for me too.
But I couldn’t understand what has been changed recently.

Is this the right place for posting issues such as this? It seems weird that it’s been three days and no comment from CircleCI on this?

Hasimo’s fix works (thank you Hasimo!), but requires making changes to circleci.yml on all our branches and projects which is a pain when there’s no apparent explanation for the change or indication if it’s permanent or not.

Yes, this is the right place, but for showstoppers like this we really recommend to open a ticket and email us at support@circleci.com