Running docker command from inside the container

Hi,

We are using a custom python based CI/CD container to build and push images to docker hub. The container is running in AWS cloud instance. After docker login we are able to pull images fine from dockerhub but not able to push images to it. We receive following error.
denied: requested access to the resource is denied

The CI/CD system is sharing the docker process from the host using -v option. In the debug logs we see following error.
errors:\ndenied: requested access to the resource is denied\nerror parsing HTTP 401 response body: unexpected end of JSON input: “”\n
The docker login is always successful.

Pushing from the host seems fine but from container it always fails.

Has anyone seen this before? Are there any recommendation for running the CI/CD system inside the docker container?

Thanks,
Pushkar

You may want to have a look at this article: http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/

Thank you Bryce.

I am following that document to setup the system.
This is running from ecs cluster with the docker socker shared with the container through the volume. I am able to run docker pull from container but not docker push.

These are some of the things i have tried so far.

  • I tried running command myself from the container but get the same error.
  • Logged out and logged back in. login is successful.

Thanks,
Pushkar