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

docker login exits with fatal "inappropriate ioctl for device" when run from cloud-init #12959

Closed
fvant opened this issue May 4, 2015 · 5 comments

Comments

@fvant
Copy link

fvant commented May 4, 2015

I am running a script to run a container from a cloud-init script (so as root).

docker ps works fine but docker login always exits with that fatal error.
BTW i do have a .dockercfg file and provide only -u 'myuser' server in the script. (adding a -e and/or -p have same result)

Running the same script in a ssh shell works fine. Could the code try to read from console, which is not there when script is run at boot??

docker info:

Containers: 0
Images: 37
Storage Driver: devicemapper
Pool Name: docker-202:1-263638-pool
Pool Blocksize: 65.54 kB
Backing Filesystem: extfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 1.452 GB
Data Space Total: 107.4 GB
Metadata Space Used: 2.298 MB
Metadata Space Total: 2.147 GB
Udev Sync Supported: true
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.89-RHEL6 (2014-09-01)
Execution Driver: native-0.2
Kernel Version: 3.14.35-28.38.amzn1.x86_64
Operating System: Amazon Linux AMI 2015.03
CPUs: 1
Total Memory: 996.3 MiB

docker version:

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.3.3
Git commit (client): a8a31ef/1.5.0
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.3.3
Git commit (server): a8a31ef/1.5.0

Environment: AWS

How reproducible: consistently, duplicating the docker login line, behave the same

@GordonTheTurtle
Copy link

Hi!
If you are reporting a new issue, PLEASE make sure that does not have any duplicates already open.

We would like to take this time to remind you of the information we need to debug the problem you are seeing. This is an automated response so if this ticket is not about a bug, do not fret.

If you fail to provide this information within 7 days, we will close this because we cannot debug your issue. We can reopen whenever the information is provided.

Thank you.

Please see:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues

Description of problem:


`docker version`:


`docker info`:


`uname -a`:


Environment details (AWS, VirtualBox, physical, etc.):


How reproducible:


Steps to Reproduce:
1.
2.
3.


Actual Results:


Expected Results:


Additional info:


#ENEEDMOREINFO

@fvant
Copy link
Author

fvant commented May 4, 2015

mkdir /home/root and exporting HOME as /home/root before doing docker login did the trick.

@adamkdean
Copy link

Following on from @fvant, the reason that works is because docker needs access to the HOME directory.

when you log in, the command stores encoded credentials in $HOME/.docker/config.json on Linux or %USERPROFILE%/.docker/config.json on Windows. Source

In my situation, I have a host machine which runs a Jenkins container with /var/run/docker.sock mapped through as a volume. This causes a few side effects from time to time, as while the client runs in the guest container, the commands are executed on the host. The most common issue this present is when you try to map a volume, as the docker run command is actually ran on the host.

With docker login, both the client and server appear to require access to the same directory/file, $HOME/.docker/config.json. The way I solved this was to run my Jenkins container with --volume /home/username:/home/username, and in my build script, export HOME="/home/username". Now both the docker server (running on host), and the docker client (running in a guest container), are looking at the same io location.

Hope this helps anyone else confused by the matter.

@adamkdean
Copy link

adamkdean commented Oct 16, 2018

@adamkdean Thanks. Having the same problem and this helps me, as I'm confused by the matter.

In case you still have problems, you may need to remove golang-docker-credential-helpers which comes with docker-compose (see this.) Though doing this kind of breaks docker-compose if you used apt to install it (in which case, install it manually like below):

curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

@nyetwurk
Copy link

nyetwurk commented Oct 24, 2018

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910822
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910823
Please, for those of you participating in this thread, go vote for https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1796119 and mark it as affecting you, or they will never get fixed.

All of these workarounds do nothing towards getting the root cause addressed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants