简体   繁体   中英

Failed to create docker base image with Debootstrap

I referred to the official Docker documentation: Create a base image and executed the following commands:

sudo debootstrap raring raring > /dev/null    
sudo tar -C raring -c . | sudo docker import - raring
sudo docker run raring cat /etc/lsb-release

I got error messages for the last command and the image "raring" was empty, 0B.

container_linux.go:247: starting container process caused "exec: \"cat\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: 
container_linux.go:247: starting container process caused "exec: \"cat\": executable file not found in $PATH".
ERRO[0000] error getting events from daemon: net/http: request canceled

Since the image was empty, I changed the target from /dev/null to ./rootfs referring to this page: How can I make my own base image for Docker?

sudo debootstrap raring ./rootfs

But the deboostrap failed to fetch Release:

I: Retrieving InRelease
I: Failed to retrieve InRelease
I: Retrieving Release
E: Failed getting release file http://archive.ubuntu.com/ubuntu/dists/raring/Release

Using wget and my browser I found that " http://archive.ubuntu.com/ubuntu/dists/raring/Release " is a 404 page.

My Linux distribution is:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

And my docker version is:

Client:
  Version:      17.04.0-ce
  API version:  1.28
  Go version:   go1.7.5
  Git commit:   4845c56
  Built:        Mon Apr  3 18:01:08 2017
  OS/Arch:      linux/amd64
Server:
 Version:      17.04.0-ce
 API version:  1.28 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Mon Apr  3 18:01:08 2017
 OS/Arch:      linux/amd64
 Experimental: false

How can I fix this problem or is there a new method that I can make my own base image? Any suggestion will be greatly appreciated. :)

The documentation is out of date -- it's listing an old non-lts release of ubuntu ( raring , 13.04 ) -- I've submitted a pull request to update it to a more-recent LTS release ( xenial , 16.04 ): https://github.com/docker/docker.github.io/pull/3859

The following commands work great though:

sudo debootstrap xenial xenial > /dev/null    
sudo tar -C xenial -c . | sudo docker import - xenial
sudo docker run xenial cat /etc/lsb-release

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM