LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-19-2017, 08:19 PM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 134

Rep: Reputation: 188Reputation: 188
Docker in Linux From Scratch


Has anyone built Docker in their Linux From Scratch system?
 
Old 08-26-2017, 12:37 PM   #2
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 134

Rep: Reputation: 188Reputation: 188
wow, I guess not.

I've found a slack-build for docker. The dependency tree (ascertained by reading the description on each slackbuild) flattens out to this (the idea is that I should compile in this order):

* google-go-lang
* libseccomp
* runc
* containerd
* tini
* docker-proxy
* docker

I am unclear if the gnu version of go can be used instead of google-go-lang. As I have that version already installed, I'm hoping it can. My gut feeling is that it cannot.

Last edited by jr_bob_dobbs; 08-26-2017 at 12:38 PM.
 
Old 09-05-2017, 12:58 PM   #3
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 134

Rep: Reputation: 188Reputation: 188
So I've re-ordered the dependency tree and compiled libseccomp and tini first. No problems.

Planned: runc, containerd, docker-proxy and then docker itself. I have stopped, not because of compilation problems, but from a concern that perhaps docker is not necesarily a good idea. My original intent is to use it to run the few programs that I just can't compile within LFS. My concern is ... is this potentially messy, in a way that cannot be reverted? Part of what I like about building my own Linux is the feeling of control. Things only go in if I want them or if they are a needed dependency of something that I want. I have an uneasy feeling.

p.s. Googling mentions people putting an LFS into docker, not the other way around. So that was less than helpful.
 
1 members found this post helpful.
Old 09-15-2017, 06:01 PM   #4
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 134

Rep: Reputation: 188Reputation: 188
Got runc in. The slackbuild provided needed hints.

Near as I can tell from browsing the .md pages (don't ask why they are not man pages (really, don't ask)) runc may be enough to run several container formats. Something about taking an OS and tarring it up into a "bundle" (flashback to macintosh?) and then a json file (which seems to be a configuration file that describes the os in the image and sets the privileges, what it can access outside the container, that sort of thing) and then "runc create" and then another call of runc to have a specific program within the container run. This is all new territory to me.

Last edited by jr_bob_dobbs; 09-15-2017 at 06:03 PM.
 
Old 09-16-2017, 07:15 AM   #5
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 134

Rep: Reputation: 188Reputation: 188
So after reading up on runc, I realized there were still gaps in my knowledge. Time to just try stuff. I've got a tar of a smallish Linux OS, previously made using the boot-root project. Said "image" worked in a VM once I added a kernel and modules. For a container, don't need those.

Code:
# mkdir /hsc/first_run/rootfs
# cd /hsc/first_run/rootfs
I then unzip .tar file to rootfs.
Then I run runc to auto-generate the config file
Code:
# runc spec
there is now a file "config.json"
Code:
# runc run
"container id cannot be empty"
# runc run foofy
 "rootfs (/hsc/first_run/rootfs/rootfs) does not exist"
# runc run .
 "rootfs (/hsc/first_run/rootfs/rootfs) does not exist"
# cd ..
# runc run rootfs
 "JSON specification file config.json not found"
# cp rootfs/config.json ./
# runc run rootfs
:0: starting container process caused ":0: applying cgroup configuration for process caused \"mountpoint for cgroup not found\""
So close. Arg.

Last edited by jr_bob_dobbs; 09-16-2017 at 07:19 AM.
 
Old 09-19-2017, 09:09 AM   #6
mid-kid
LQ Newbie
 
Registered: Oct 2016
Distribution: Gentoo
Posts: 25

Rep: Reputation: Disabled
@jr_bob_dobbs:

If you're concerned about running programs you want to try before "committing" them to your machine, you might be better out just installing debian or something in a chroot. It's fairly easy to set up with debootstrap, and a simple script for entering/leaving the chroot. Hell, LXC might even be a pretty good option for this.
Docker is fine, but it only adds in value that you can manage and create containers in a stateless way; one you're done with them, you remove them, and you can just make a new one from a debian base image whenever you need one again. You don't have to worry about messing up the container because if you do, you simply start over from your base image. You could emulate this yourself with overlayfs and some scripting, but it's simply not as handy as docker.

As for building Docker, I did this myself recently, mostly following the Arch PKGBUILD: https://git.archlinux.org/svntogit/c...ackages/docker
Why Arch, instead of SlackBuilds? Because the SlackBuilds for Docker are, frankly, a mess. Most of the dependencies of docker aren't stable yet, and need weird compilation instructions. This PKGBUILD includes everything docker needs, with the correct versions for everything.
I made my own packaging script, in which I tried to clean up Arch's build script: http://chunk.io/midkid/9c263adc34f244cc835f72c402030423
The only dependencies for this are go, libseccomp, and optionally, go-md2man.
The build process consists of simply setting up a correct GOPATH, and building, in order: Docker (engine, cli), runc, containerd, tini and proxy. Some of these are picky about where you run make from, such as runc, and how you call go build, such as gen-manpages.

EDIT: Oh, I forgot to mention, there's actually a quick&dirty way of installing Docker, but it involves a script that calls upon git, which is why it isn't really suitable for the packaging script standards a lot of distros try to uphold. This method is described in VoidLinux' script: https://github.com/voidlinux/void-pa...ocker/template
It consists of downloading docker-ce, and in the components/engine directory calling hack/make.sh with AUTO_GOPATH=1, along with hack/dockerfile/install-binaries.sh, which you'll have to modify using sed if you want to install to a prefix other than /usr/local.
Of course, this won't include manpages and as such is a far cry from a proper packaging method for Docker.

Last edited by mid-kid; 09-19-2017 at 09:19 AM.
 
Old 10-01-2017, 11:08 PM   #7
ChrootDoot
LQ Newbie
 
Registered: Oct 2017
Posts: 2

Rep: Reputation: Disabled
Successfully compiled on a LinuxFromScratch system, following the VoidLinux script, and compilation itself was relatively easy. Getting Docker to run, however, took some troubleshooting. Here are some tips for anyone else having difficulty, which worked on my end:

- Docker (Go) did not find ca-certs in its default location, it needed a symlink to one of the locations specified here: https://github.com/golang/go/blob/ma.../root_linux.go

- This script is useful for installing necessary kernel modules: https://github.com/moby/moby/blob/ma...heck-config.sh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to install Docker and run Docker containers on Linux Mint 18/18.1 LXer Syndicated Linux News 1 12-13-2016 11:11 AM
LXer: Linux From Scratch and Beyond Linux From Scratch 7.9 Books Officially Released LXer Syndicated Linux News 0 03-11-2016 09:40 AM
LXer: Red Hat partners with Docker to create Linux/Docker software stack LXer Syndicated Linux News 0 03-12-2015 05:54 PM
LXer: Build Debian Docker Image from Scratch LXer Syndicated Linux News 0 08-02-2014 09:30 PM
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration