I’ve been trying to create a minimal docker image for RHEL versions, for one of my projects. The following were the steps I followed:
a) Installed a RHEL6.5 server with ‘Minimal Installation’.
b) Registered it to the local satellite.
c) Created a tar-ball of the filesystem with the command below:
# tar --numeric-owner --exclude=/proc --exclude=/sys --exclude=/mnt --exclude=/var/cache --exclude=/usr/share/doc --exclude=/tmp --exclude=/var/log -zcvf /mnt/rhel6.5-base.tar.gz /
d) Load the tar.gz image using ‘docker load’ (as per the man page of ‘docker load’)
# docker load -i rhel6.5-base.tar.gz
This is where it erred with the message:
2014/08/16 20:37:42 Error: open /tmp/docker-import-123456789/repo/bin/json: no such file or directory
After a bit of searching and testing, I found that ‘docker load -i’ doesn’t work as expected. The workaround is to cat and pipe the tar.gz file, as shown below:
# cat rhel6.5-base.tar.gz | docker import - rhel6/6.5
This ends up with the image showing up in ‘docker images’
# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE rhel6/6.1 latest 32b4b345454a About a minute ago 1.251 GB
Update: ‘docker load -i <image-file>’ would only work if the image is created as a layered docker image. If the <image-file> is a tar ball created from a root filesystem, you would need to use ‘cat <image-file> | docker import <name>’
Reblogged this on cmattoon.com.
Have you check the image you load via “docker import”?
I use your method but have problem to run this kind of docker images
tar cvf image.tar image/ —>cd image/ tar cvf image.tar * this is the issue!!!!
Chen, thank you for your pointer. This was done at least 2 years back while testing out docker.
Back then, it was not even in 1.0. This may not be the case with the current version.
hi man,
thanks for your post, and i knew it back to two years ago, bout have you done any activity for now?
or any suggest, many thanks
I’ve not looked into the latest developments in Docker yet. As said it was two years back, as part of creating a trivial tool. You can see the code at https://github.com/arvimal/rhdock
thanks anyway