Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Cannot correctly guess image type from name of format: image-name-with-hyphens:some_hash #3326

@grep-stripe

Description

@grep-stripe

Environment

systemctl: command not found
rkt Version: 1.15.0
appc Version: 0.8.7
Go Version: go1.7.1
Go OS/Arch: linux/amd64
Features: -TPM +SDJOURNAL
--
Linux 4.4.0-45-generic x86_64
--
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
--

What did you do?

sudo rkt --debug run stripe-internal-henson-test-subject:f6432b725a9a5f27eaecfa47a0cbab3c0ea00f22 --exec /bin/bash
image: using image from local store for image name coreos.com/rkt/stage1-coreos:1.15.0
run:
  └─an unsupported URL scheme "stripe-internal-henson-test-subject" - the only URL schemes supported by rkt are docker, http, https and file

What did you expect to see?

I expected it to start a container.

What did you see instead?

It emitted an error.

This is because url.Parse() is a little screwy when you pass it an argument that includes a string with hyphens followed by a colon. The hash/tag bit at the end of the image name doesn't matter. See these two play.golangs:

https://play.golang.org/p/Ov1sddryW0
and
https://play.golang.org/p/1nSGYoAg13

If there is a list of supported URL schemes, then we should perhaps check for one of those here, instead of just making sure that URL scheme is not "":

https://github.com/coreos/rkt/blob/0d4c0fe7fdb8e42861bb94cdafa902bf4ad72815/rkt/image/common.go#L162

This works with images that have /'s in them, because the url.Scheme ends up coming back as "", and so you proceed on to detect it as an image name. But, because this has a : in it and no /, it ends up being detected, basically, as a bare url scheme, because it's at the beginning of the string.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions