I’ve encountered a weird problem and I do not know how to proceed.
I have docker 18.09.2, build 6247962 on a VMware ESXi 6.5 virtual machine running Ubuntu 18.04. I have docker 19.03.3, build a872fc2f86 on a Azure virtual machine running Ubuntu 18.04. I have the following little test script that I run on both hosts and in different docker containers:
#!/usr/bin/python3
import fcntl
import structimage_path = ‘foo.img’
f_obj = open(image_path, ‘rb’)
binary_data = fcntl.ioctl(f_obj, 2, struct.pack(‘I’, 0))
bsize = struct.unpack(‘I’, binary_data)[0]
print(‘bsize={0}’.format(bsize))
exit(0)
I run “ps -ef >foo.img” to get the foo.img file. The output of the above script on both virtual machines is bsize=4096.
I have the following Dockerfile on both VMs:
FROM ubuntu:19.04
RUN apt-get update &&
apt-get install -y
python
python3
vimWORKDIR /root
COPY testfcntl01.py foo.img ./
RUN chmod 755 testfcntl01.py
If I create a docker image with the above Dockerfile on the VM running docker 18.09.2, the above gives me the same results as the host.
If I create a docker image with the above Dockerfile on the VM running docker 19.03.3, the above gives me the following error:
root@d317404714a6:~# ./testfcntl01.py
Traceback (most recent call last):
File “./testfcntl01.py”, line 9, in
binary_data = fcntl.ioctl(f_obj, 2, struct.pack(‘I’, 0))
OSError: [Errno 22] Invalid argument
I compared the docker directory structure, the daemon.json file, the logs, the “docker info” between the hosts. They look to be identical. I tried with a FROM ubuntu:18.04 as well as ubuntu:19.04. I’ve tried with python2 as well as python3. Same results.
I do not know why the fcntl fails only on a docker container on the Azure VM running docker 19.03.3. Did something change in docker between 18 and 19 that might have caused this? Is there some configuration change that I need to make to get this to work? Something else I’m missing?
Any help would be greatly appreciated.
Thank you
Lewis Muhlenkamp