Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseImages: Updating base image versions #1285

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

garethtdavies
Copy link
Contributor

@nghiant2710 I've manually updated the base image page for updated version information and to get a better sense of how it works before trying to pull this information in dynamically from the contracts.

I wrote a simple script to parse the version field for each variant from here for Node.js for example https://github.com/balena-io/contracts/blob/master/contracts/sw.stack/node/contract.json. A couple of questions as result:

Change-type: patch
Signed-off-by: Gareth Davies [email protected]

@nghiant2710
Copy link
Contributor

nghiant2710 commented Dec 21, 2019

Great work @garethtdavies 👍

Regarding your questions:

  1. We only keep the latest version in contracts so you won't find information about old version there.
  2. We do support raspbian and all devices with arch.sw = rpi will be built off balenalib/rpi-raspbian. As the raspbian images are not available on dockerhub, we create the balenalib/rpi-raspbian from this repo https://github.com/balena-io-library/resin-rpi-raspbian and all base images of raspberry-pi device type (RPi 1 and Zero) will be Raspbian. For some reasons discussed long time ago, we want to have raspberry-pi-debian as an alias of rpi-raspbian so you will see rpi in debian contract here https://github.com/balena-io/contracts/blob/master/contracts/sw.os/debian/contract.json

| Go | 1.12.7 | armv7hf, aarch64, amd64, i386, armv6 |
| Dotnet | 2.2-sdk | armv7hf, aarch64, amd64 |
| Node.js | v13.1.0 | armv6, armv7hf, aarch64, amd64, i386 |
| Python | v2.7.17 | armv5e, armv6, armv7hf, aarch64, amd64, i386 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's also worth having a separate Python3 language tag, bearing in mind the upcoming EOL of Python2 ? https://pythonclock.org/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also part of the page which says "latest points to the latest Python 2 version, which currently is 2.7.17" and I guess that means there's currently no way to automatically get the latest Python 3 version?

Copy link
Contributor Author

@garethtdavies garethtdavies Jan 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this one. I'd have thought using 3 would do it but that doesn't seem to work as expected:

docker run -it balenalib/raspberrypi4-64-alpine-python:3-3.11-run bash
bash-5.0# python --version
Python 3.6.9

Copy link
Contributor Author

@garethtdavies garethtdavies Jan 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that's the default package available i.e via apt-get install python3? I don't think that is correct and I don't know why it would default to that version when 3.8 is available https://github.com/balena-io-library/base-images/tree/master/balena-base-images/python/raspberrypi4-64/alpine/3.11

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created balena-io-library/base-images#606 to track this inconsistency

@garethtdavies
Copy link
Contributor Author

garethtdavies commented Dec 23, 2019

Thanks for this explanation @nghiant2710 . I've tested this quite a bit now, but I am still a bit confused about Raspbian and how to document it.

I understand those device types with device type raspberry-pi will use Raspbian by default, but later variants, notably, the Pi3 does not. If I use the machine name raspberrypi3 or %%BALENA_MACHINE_NAME%% I am always going to get Debian if I don't specify an OS. I can specify Ubuntu, Fedora, and Alpine but not Raspbian, so to get Raspbian on the Pi3 I can get it e.g.:

FROM balenalib/raspberry-pi (i.e. a device type of raspberry pi)
FROM balenalib/rpi-raspbian:jessie
FROM balenalib/raspberry-pi-debian

I guess I'm expecting these to work, but they, of course, do not:

FROM balenalib/raspberrypi3-raspbian
FROM balenalib/%%BALENA_MACHINE_NAME%%-raspbian

So, I'm not sure how we should document this for Raspbian. Basically, if you want to use Raspbian, use the base image balenalib/rpi-raspbian with available tags of jessie, stretch and buster? (I also tested this on 32 and 64-bit host OS and worked on both)

Copy link
Contributor

@xginn8 xginn8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nits, otherwise lgtm

pages/reference/base-images/base-images.md Outdated Show resolved Hide resolved
pages/reference/base-images/base-images.md Outdated Show resolved Hide resolved
pages/reference/base-images/base-images.md Outdated Show resolved Hide resolved
@lurch
Copy link
Contributor

lurch commented Dec 23, 2019

In case it helps to clear up any confusion (at least from the Raspbian side, if not from the Balena side 😉 ) - the Raspbian images available from https://www.raspberrypi.org/downloads/raspbian/ support all models of the Raspberry Pi (Pi1, Pi Zero, Pi2, Pi3, Pi4) with a single image (which is presumably why there's no raspberrypi3-raspbian), and it's a 32-bit kernel and 32-bit userland.

I dunno how closely Balena's raspbian images follow the Raspberry Pi raspbian images though.

@nghiant2710
Copy link
Contributor

@garethtdavies, you're right, only raspberry-pi device type is raspbian, as you can run armv7 debian images on Pi2 so we use it as the base images for Pi2 and Pi3. However, we do add raspbian package source and pre-install userland in the Pi2 and Pi3 base images (basically armv7hf debian will raspbian userland installed).

Another thing is debian is the default OS for the base images, if you don't specify OS in the base images then you will get debian (or raspbian in case of raspberry-pi).

@garethtdavies garethtdavies force-pushed the 1254-base-images-update branch from 5293470 to 6a36c5a Compare December 31, 2019 20:05
@garethtdavies
Copy link
Contributor Author

Thanks all for the discussion, that's much clearer to me now 😄 At the root of this is simply what we should include in the docs with reference to Raspbian. To that end, I've added a note to the docs about Raspbian. @nghiant2710 can you review this note https://github.com/balena-io/docs/pull/1285/files#diff-aa7d2966be46f689a147702028e9ac59R129 or have any other suggestions about any other missing information or where this should be included?

I've also updated this file for the latest contracts, and I have done a general cleanup, but I'll follow up with additional PRs for auto-generating these docs.

@garethtdavies garethtdavies force-pushed the 1254-base-images-update branch from 6a36c5a to a93037c Compare December 31, 2019 20:40
@garethtdavies garethtdavies changed the title [WIP] images: Updating base image versions baseImages: Updating base image versions Jan 6, 2020
@garethtdavies garethtdavies force-pushed the 1254-base-images-update branch from 74fe36e to ba494ee Compare January 6, 2020 19:56
If no variant is specified, the image defaults to `run`
- <yyyymmdd> the last optional field on tags is the date tag. This is useful for production deployments as these base images are non-moving tags, so no packages in these will update ever.
- `<lang_ver>` is the version of the language stack, for example, Node.js 10.10, it can also be substituted for `latest`.
- `<distro_ver>` is the version of the Linux distro, for example in the case of Debian, there are 4 valid versions, namely `sid`, `jessie`, `buster` and `stretch`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this mention that latest can also be used for the <distro_ver> tags?

- `<lang_stack>` is the programming language pack, currently we support Node.js, Python, OpenJDK and Go. This field is optional and if left out, no language pack will be installed, so you will just have the distribution.
- `<hw>` is either architecture or device type and is **mandatory**. If using Dockerfile.templates, you can replace this with `%%BALENA_MACHINE_NAME%%` or `%%BALENA_ARCH%%`. For a list of available device names and architectures, see the [Device types](/reference/base-images/devicetypes/).
- `<distro>` is the Linux distribution. Currently there are 4 distributions, namely Debian, Alpine, Ubuntu and Fedora. This field is optional and will default to Debian if left out.
- `<lang_stack>` is the programming language pack, currently we support Node.js, Python, OpenJDK and Go. This field is optional, and if left out, no language pack will be installed, so you will just have the distribution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I guess if you specify a <lang_ver> but not a <lang_stack>, the lang_ver will just be ignored?

Copy link
Contributor Author

@garethtdavies garethtdavies Jan 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be ignored and it'd probably just mean the image doesn't exist (unless it happened to coincide with an available tag) - but either way, it's unlikely to be what you want. For example, you can see the raspberrypi3-alpine tags here https://hub.docker.com/r/balenalib/raspberrypi3-alpine/tags so if you specified a <lang_ver> tag of 10.8 (e.g. node) then there simply isn't a corresponding image.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I was just checking what the edge-case behaviour was 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently balenalib supports the following OS distributions and Language stacks, if you would like to see others added, create an issue on the [balena base images repo](https://github.com/balena-io-library/base-images/issues).
Currently, balenalib supports the following OS distributions and Language stacks, if you would like to see others added, create an issue on the [balena base images repo]({{ $links.githubLibrary }}/base-images/issues).

| Distribution | Default | Supported Architectures |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably in both this table and the next, the "Default" column is the version you'd get if you used the latest tag for the <distro_ver> or <lang_ver> fields?
Is it worth mentioning that explicitly? (e.g. by changing the "Default" column-header to "Default (latest)" ? ) 🤷‍♂️


Hmmm, in the "Multiple Distributions:" and "Multiple language stacks:" lists earlier on in the page, I wonder if it'd be worth highlighting the versions corresponding to the "latest" tag by e.g. displaying them in bold? Like:

  • Node.js: 8.11.1, 8.17.0, 9.11.2, 10.18.0, 11.15.0, 12.14.0 and 13.5.0
  • Python: 2.7.17, 3.4.10, 3.5.7, 3.6.9, 3.7.5 and 3.8.0

- `<distro>` : omitted, so it defaults to Debian.
- `<lang>` : node - the Node.js runtime and npm will be installed
- `<lang_ver>` : 10.10 - This gives us node.js version 10.10.x whatever is the latest patch version provided on balenalib
- `<distro_ver>` : omitted, so it defaults to `stretch`
- `<lang_ver>` : 10.18 - This gives us Node.js version 10.18.x whatever is the latest patch version provided on balenalib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Multiple language stacks:" list further up the page lists "Node.js 10.18.0" but here you're using a <lang_ver> of 10.18. Does that imply that balenalib/raspberrypi3-node:10.18, balenalib/raspberrypi3-node:10.18.0 and balenalib/raspberrypi3-node:10 are all equally valid base-image names? Or is there some other logic at work?

Possibly worthy of more explanation? 🤷‍♂️

Copy link
Contributor Author

@garethtdavies garethtdavies Jan 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. You can confirm this via docker pull balenalib/raspberrypi3-node:10.18 (and other tags) and inspecting the output of docker images which shows they are all the same image (for this specific example). As I noted earlier I think a few more examples would go a long way for this sort of information.

➜ ~ docker images
REPOSITORY                                                         TAG                   IMAGE ID            CREATED             SIZE
balenalib/raspberrypi3-node                                        10                    3bf113fa9176        15 hours ago        231MB
balenalib/raspberrypi3-node                                        10.18                 3bf113fa9176        15 hours ago        231MB
balenalib/raspberrypi3-node                                        10.18.0               3bf113fa9176        15 hours ago        231MB

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I wonder if this might explain the behaviour you discovered at #1285 (comment) where balenalib/raspberrypi4-64-alpine-python:3-3.11-run points to an image containing Python 3.6.9 (whereas you'd expect it to contain Python 3.8.0) ...

Perhaps when python:3.6.9 got added, it also added the python:3.6 and python:3 tags, inadvertently "overwriting" the python:3 tag which was previously pointing to python:3.8.0?

That's just a guess though, and only @nghiant2710 will know for sure.

| Distribution | Default | Supported Architectures |
| ------------ | ---------------------------- | -------------------------------------------- |
| Debian | Debian GNU/Linux 10 (buster) | armv5e, armv6, armv7hf, aarch64, amd64, i386 |
| Alpine | Alpine Linux v3.10 | armv6, armv7hf, aarch64, amd64, i386 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I've just noticed that this table says that the Default version of Alpine is v3.10, and by comparing Digests on https://hub.docker.com/r/balenalib/raspberrypi3-alpine/tags you can also confirm that the latest and 3.10 tags point to the same image, and yet Alpine 3.11 is mentioned in the "Multiple Distributions:" list on this page, and there's a 3.11 tag on DockerHub? 😕

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that's explained by balena-io/contracts@84035e0#r36690619 but that's a bit of a random stab in the dark 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks like a mistake as mentioned in that linked contract above. In general though latest doesn't necessarily mean "latest" 😕https://medium.com/@mccode/the-misunderstood-docker-tag-latest-af3babfd6375 In this case though it looks like it should have been tagged latest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting, but I've no idea how and/or if Docker tags relate to the base-image tags used by Balena 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand that comment. The tags on Docker Hub are the base-image tags.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The medium.com article you've linked to mentions tags like marc/test:latest and it seems like the latest tag there is automatically added by Docker. I was assuming that that's actually unrelated to the latest tag embedded within a Balena image-name like balenalib/raspberrypi3-alpine-python:latest-3.7 ? 🤷‍♂️ 🤷‍♂️

@garethtdavies garethtdavies force-pushed the 1254-base-images-update branch from ba494ee to 7d4ab52 Compare January 8, 2020 21:07
@garethtdavies
Copy link
Contributor Author

Squashed and rebased. I'm keen to get this in, in its current state, as the current docs are outdated and this fixes that. I'll take some of the unresolved suggestions to a follow-up PR as I'll likely need to tweak the layout to generate this doc from the contracts anyway.

@lurch
Copy link
Contributor

lurch commented Jan 8, 2020

Apologies if my comments / questions have delayed this PR, but hopefully they were more of a help than a hindrance.

@garethtdavies
Copy link
Contributor Author

Oh no @lurch they have been super helpful and have helped clarify a lot of things. I didn't just want to merge this in under the assumption everything was resolved r.e. discussions above, so the note to acknowledge that. We can carry on the discussion but I don't want to delay getting at least the updated version information in 👍

Change-type: patch
Signed-off-by: Gareth Davies <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants