Skip to content

'az container exec' does NOT run /bin/bash #15856

@alexeyshishkin01

Description

@alexeyshishkin01

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

I've created the Docker image and I can launch container from it using 'docker' tool:
docker build --compress --tag $image_id:$tag_id --file Dockerfile-$image_id .

I can successfully run /bin/bash inside a container:
'docker exec --interactive --tty PostgresProStandard12 bash'

I've put the image into ACR and I can launch container from it using 'az' tool:
az container create
--resource-group dockers
--name debiandocker
--image $loginServer_id/$image_id:$tag_id
--cpu 2
--memory 2
--registry-login-server $loginServer_id
--registry-username pgprostdacr
--registry-password $password_id
--dns-name-label $image_id
--ports 5433
--no-wait

I used to run /bin/bash inside a container some time ago
az container exec
--resource-group dockers
--name debiandocker
--exec-command "/bin/bash"
--container-name debiandocker

but I cannot do it now - when I run previous command, nothing happens - I simply stay in my OS CLI environment

I can verify the container is up & running by:

az container list
--resource-group dockers

az container show
--resource-group dockers
--name debiandocker

az container logs
--resource-group dockers
--name debiandocker
--container-name debiandocker

az container attach
--resource-group dockers
--name debiandocker
--container-name debiandocker

It looks to me something has been broken with 'az' tool, since it all worked before and have not changed anything in my Dockerfile.

To Reproduce

Create container and try to run /bin/bash inside of it

Expected behavior

By running

az container exec
--resource-group dockers
--name debiandocker
--exec-command "/bin/bash"
--container-name debiandocker

I expect, like before, to get inside of container

Environment summary

root@ubuntu16:~# az --version
azure-cli 2.14.2

core 2.14.2
telemetry 1.0.6

Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.10 (default, Nov 9 2020, 06:00:25)
[GCC 5.4.0 20160609]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

It used to work without any issues, probably several months ago, but does not work any longer.
Since I have not changed anything with my Dockerfile and it still works with 'docker' tool, I suspect something wrong with 'az' tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions