scaleway / image-builder

:triangular_ruler: build server images on Scaleway
MIT License
66 stars 9 forks source link

Building a custom image always fails #20

Closed tboerger closed 6 years ago

tboerger commented 7 years ago

I tried to build a custom image several times since yesterday. I'm using the official image-builder and the documented way to start and attach via scw, than I have created a Dockerfile and the Makefile, the initial build process is running fine with make image_on_local, but than it ALWAYS fails and I keep non-running servers within my account:

# make image_on_local
test -f /tmp/create-image-from-http.sh \
|| wget -qO /tmp/create-image-from-http.sh https://github.com/scaleway/scaleway-cli/raw/master/examples/create-image-from-http.sh
chmod +x /tmp/create-image-from-http.sh
ln -sf /tmp/build/x86_64-docker-latest/rootfs.tar /tmp/build/x86_64-docker-latest/x86_64-docker-latest.tar
IMAGE_ARCH="x86_64" VOLUME_SIZE="50G" IMAGE_NAME="docker" IMAGE_BOOTSCRIPT="docker" /tmp/create-image-from-http.sh http://51.15.197.224:8003/x86_64-docker-latest/x86_64-docker-latest.tar
[+] URL of the tarball: http://51.15.197.224:8003/x86_64-docker-latest/x86_64-docker-latest.tar
[+] Target name: x86_64-docker-latest.tar
[+] Creating new server in rescue mode with a secondary volume...
[+] Server created: d70868e6-c5e8-499a-b1fb-3302c7776b73
[+] Booting...
Linux vm-10-3-9-13 4.4.88-mainline-rev1 #1 SMP Wed Sep 13 23:49:03 UTC 2017 x86_64 GNU/Linux
[+] Server is booted
[+] Formating and mounting disk...
FATA[0000] cannot execute 'exec': Failed to get server information for d70868e6-c5e8-499a-b1fb-3302c7776b73: unexpected end of JSON input
docker-rules.mk:185: recipe for target 'image_on_local' failed
make: *** [image_on_local] Error 1
tboerger commented 7 years ago

And this now happens on an entirely fresh image-builder setup:

# make image_on_local
wget -qO - https://j.mp/scw-builder | bash
--2017-10-06 09:11:00--  https://raw.githubusercontent.com/scaleway/image-tools/master/builder/docker-rules.mk
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.16.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.16.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15986 (16K) [text/plain]
Saving to: ‘docker-rules.mk’

docker-rules.mk                                                     100%[=================================================================================================================================================================>]  15.61K  --.-KB/s    in 0.009s

2017-10-06 09:11:01 (1.78 MB/s) - ‘docker-rules.mk’ saved [15986/15986]

test -f /tmp/create-image-from-http.sh \
  || wget -qO /tmp/create-image-from-http.sh https://github.com/scaleway/scaleway-cli/raw/master/examples/create-image-from-http.sh
chmod +x /tmp/create-image-from-http.sh
touch .overlays
test x86_64 = x86_64 || make setup_binfmt
docker build  -t scaleway/docker:amd64-latest .
Sending build context to Docker daemon 20.99 kB
Step 1 : FROM scaleway/ubuntu:amd64-xenial
amd64-xenial: Pulling from scaleway/ubuntu
5ac232d7b5aa: Pull complete
579bf65ca2c5: Pull complete
4be1dc438a59: Pull complete
1c1f5089b70b: Pull complete
531e838cb4f5: Pull complete
0b74e5b993a5: Pull complete
74cba3801a35: Pull complete
4680d3d5ddb6: Pull complete
4e8c964bc8e3: Pull complete
566c8dbc0bf1: Pull complete
ce97a47f820d: Pull complete
6d00f799cb0f: Pull complete
f19ab41efddc: Pull complete
d220f9784f0c: Pull complete
22a659b0b7b4: Pull complete
c2b2758111dc: Pull complete
c95bb3345eef: Pull complete
Digest: sha256:0c2def04deaaa334e604bc3fe2ec4e82b536b75648d01b348afac8cb6bbf986a
Status: Downloaded newer image for scaleway/ubuntu:amd64-xenial
 ---> 6cde67902b03
Step 2 : ENV DEBIAN_FRONTEND noninteractive
 ---> Running in 787f3957c2ab
 ---> 7331e4f72548
Removing intermediate container 787f3957c2ab
Step 3 : RUN /usr/local/sbin/scw-builder-enter
 ---> Running in bf5b4c24a86e
Adding 'local diversion of /sbin/initctl to /sbin/initctl.distrib'
 ---> 0bf34ba42990
Removing intermediate container bf5b4c24a86e

SNIP

Step 12 : RUN sed -i 's/without-password/yes/' /etc/ssh/sshd_config
 ---> Running in a992d69f84d9
 ---> 2c64fc772cbe
Removing intermediate container a992d69f84d9
Step 13 : RUN /usr/local/sbin/scw-builder-leave
 ---> Running in bd33baaa1bf8
Removing 'local diversion of /sbin/initctl to /sbin/initctl.distrib'
 ---> e03556ea86c5
Removing intermediate container bd33baaa1bf8
Successfully built e03556ea86c5
for tag in 2017-10-06 1.0.0 1.0 1; do                                                \
  echo docker tag scaleway/docker:amd64-latest scaleway/docker:amd64-$tag;   \
  docker tag scaleway/docker:amd64-latest scaleway/docker:amd64-$tag;    \
done
docker tag scaleway/docker:amd64-latest scaleway/docker:amd64-2017-10-06
docker tag scaleway/docker:amd64-latest scaleway/docker:amd64-1.0.0
docker tag scaleway/docker:amd64-latest scaleway/docker:amd64-1.0
docker tag scaleway/docker:amd64-latest scaleway/docker:amd64-1
docker inspect -f '{{.Id}}' scaleway/docker:amd64-latest > .docker-container-x86_64.built
mkdir -p /tmp/build/x86_64-docker-latest/
docker run --name docker-latest-export --entrypoint /dontexists scaleway/docker:amd64-latest 2>/dev/null || true
docker export docker-latest-export > /tmp/build/x86_64-docker-latest/export.tar.tmp
docker rm docker-latest-export
docker-latest-export
mv /tmp/build/x86_64-docker-latest/export.tar.tmp /tmp/build/x86_64-docker-latest/export.tar
rm -rf /tmp/build/x86_64-docker-latest/rootfs /tmp/build/x86_64-docker-latest/rootfs.tmp
mkdir -p /tmp/build/x86_64-docker-latest/rootfs.tmp
tar -C /tmp/build/x86_64-docker-latest/rootfs.tmp -xf /tmp/build/x86_64-docker-latest/export.tar
rm -f /tmp/build/x86_64-docker-latest/rootfs.tmp/.dockerenv /tmp/build/x86_64-docker-latest/rootfs.tmp/.dockerinit
chmod 1777 /tmp/build/x86_64-docker-latest/rootfs.tmp/tmp
chmod 755 /tmp/build/x86_64-docker-latest/rootfs.tmp/etc /tmp/build/x86_64-docker-latest/rootfs.tmp/usr /tmp/build/x86_64-docker-latest/rootfs.tmp/usr/local /tmp/build/x86_64-docker-latest/rootfs.tmp/usr/sbin
chmod 555 /tmp/build/x86_64-docker-latest/rootfs.tmp/sys
chmod 700 /tmp/build/x86_64-docker-latest/rootfs.tmp/root
mv /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/hosts.default /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/hosts || true
echo "IMAGE_ID=\"Ubuntu with Docker\"" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
echo "IMAGE_RELEASE=2017-10-06" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
echo "IMAGE_CODENAME=docker" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
echo "IMAGE_DESCRIPTION=\"Ubuntu Xenial image including Docker\"" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
echo "IMAGE_HELP_URL=\"https://community.scaleway.com\"" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
echo "IMAGE_SOURCE_URL=\"https://gitea.int.owncloud.com/demos/image\"" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
echo "IMAGE_DOC_URL=\"\"" >> /tmp/build/x86_64-docker-latest/rootfs.tmp/etc/scw-release
mv /tmp/build/x86_64-docker-latest/rootfs.tmp /tmp/build/x86_64-docker-latest/rootfs
tar --format=gnu -C /tmp/build/x86_64-docker-latest/rootfs -cf /tmp/build/x86_64-docker-latest/rootfs.tar.tmp .
mv /tmp/build/x86_64-docker-latest/rootfs.tar.tmp /tmp/build/x86_64-docker-latest/rootfs.tar
ln -sf /tmp/build/x86_64-docker-latest/rootfs.tar /tmp/build/x86_64-docker-latest/x86_64-docker-latest.tar
IMAGE_ARCH="x86_64" VOLUME_SIZE="50G" IMAGE_NAME="docker" IMAGE_BOOTSCRIPT="docker" /tmp/create-image-from-http.sh http://51.15.218.65:8000/x86_64-docker-latest/x86_64-docker-latest.tar
[+] URL of the tarball: http://51.15.218.65:8000/x86_64-docker-latest/x86_64-docker-latest.tar
[+] Target name: x86_64-docker-latest.tar
[+] Creating new server in rescue mode with a secondary volume...
[+] Server created: 8ca12026-61dc-4d7c-8f3a-dbcd113d8bfe
[+] Booting...
FATA[0177] cannot execute 'exec': Failed to wait for server to be ready, unexpected end of JSON input
docker-rules.mk:185: recipe for target 'image_on_local' failed
make: *** [image_on_local] Error 1
smola commented 6 years ago

I've got the same error. Fixed it by updating scaleway-cli:

wget -O /usr/bin/scw https://github.com/scaleway/scaleway-cli/releases/download/v1.14/scw-linux-amd64
remyleone commented 6 years ago

@tboerger Did the tip from @smola worked for you?

tboerger commented 6 years ago

It just worked afterwards, but I had to move my project anyway away from scaleway because my required servers had been out of stock without an estimation when new machines will be available.