Docker-Based Developer Resource#5871
Conversation
|
Is it worth referring to this from @ax3l's Docker workflow? Seems like this could be used to kickstart some of what is in there. @ax3l? |
|
Another important lesson that I learned that is relevant to both @ax3l's documentation and this work: On Mac and Windows, docker runs in a hypervisor that is allocated a low amount of memory by default (e.g.: 2 GB on my 16 GB Macbook Pro). This short supply of memory was actually the cause of the strange internal compiler errors I was running into while trying to build boost. We should definitely add a note for docker users to make sure that they increase the memory allocated to the hypervisor; ideally to as much as they can tolerate dedicating to docker. All my spack builds were running beautifully once I set my system to allocate 8 GB to docker. |
|
Thanks for the ping and the PR! A few thoughts: If you install lmod (yay!) instead of modules, you might want to change the default in On git clone, I would use MPI won't work without openssh-server installed. For some downloads, I think I like your use of
Interesting observation! Yes, please add a note in the docker workflow section on that if you like! config:
build_jobs: 2 |
ax3l
left a comment
There was a problem hiding this comment.
just a few notorious inline comments :)
cool work!
share/spack/docker/README.md
Outdated
| @@ -0,0 +1,20 @@ | |||
| Using this docker container for development. | |||
| ------------ | |||
There was a problem hiding this comment.
is that the proper amount of -- for formating? :)
share/spack/docker/README.md
Outdated
| $ docker-compose run --rm ubuntu | ||
|
|
||
| This command should drop you into an interactive shell where you can run spack | ||
| within an isolated docker container running ubuntu. The copy of spack being |
share/spack/docker/README.md
Outdated
| Using this docker container for development. | ||
| ------------ | ||
|
|
||
| $ cd share/spack/docker |
There was a problem hiding this comment.
if you like you can add syntax highlighting for bash like this in markdown
| @@ -0,0 +1,25 @@ | |||
|
|
|||
| git clone git://github.com/llnl/spack.git /spack && \ | ||
| rm -rf /spack/.git && rm -rf /var/lib/apt/lists/* | ||
|
|
||
|
|
| WORKDIR /spack | ||
| ENTRYPOINT ["bash"] | ||
| CMD ["-l"] | ||
|
|
There was a problem hiding this comment.
double instead of single EOF newline
| WORKDIR /spack | ||
| ENTRYPOINT ["bash"] | ||
| CMD ["-l"] | ||
|
|
There was a problem hiding this comment.
double instead of single EOF newline
share/spack/docker/README.md
Outdated
| you make should be immediately reflected in the running docker container. | ||
|
|
||
| To work within a container running a different linux distro, change the "ubuntu" | ||
| argument to any one of the services listed under the ``docker-compose.yml`` |
There was a problem hiding this comment.
I think the double "`" is rst not md :)
There was a problem hiding this comment.
if you write this file in full .rst instead of .md one can also easier include it into the main sphinx docs into the developer workflows :)
|
Holy hell, thank goodness for Github's "restore branch" feature...today, I am worthy of the "bonehead of the year" award! 👎 |
|
Also, if someone can reopen, that would be great! :) |
|
@ax3l thanks a bunch for the valuable feedback. Please have a look at my latest additions and let me know what you think. Please, keep in mind that I haven't yet had the chance to update the Fedora environment, and that there seems to be a known issue related to running Fedora on docker (see https://bugzilla.redhat.com/show_bug.cgi?id=1483553 for details). |
ax3l
left a comment
There was a problem hiding this comment.
Very nice, thank you for the updates!
I have a few structural inline comments to reduce duplication.
I am wondering if someone wants to add a centos and arch image to the composer as well?
| ================================= | ||
|
|
||
| This guide is intended for people who want to use our prepared docker | ||
| environments to work on developing Spack or working on spack packages. It is |
There was a problem hiding this comment.
Are you intentionally making double spaces after .s? :)
There was a problem hiding this comment.
Aye; chalk it up to a habit I learned from grade school. I should write a quick script to look for these things. [:
lib/spack/docs/workflows.rst
Outdated
| # image run hook: the -l will make sure /etc/profile environments are loaded | ||
| CMD /bin/bash -l | ||
|
|
||
| For examples of how we use docker in development, see |
There was a problem hiding this comment.
Just to keep this section focused, I would move this fully in the Best Practices section immediately below.
New sub-sections with """" level:
- docker in development (this reference)
- OSX, Windows (the paragraph as text instead of a note)
| # Per-user settings (overrides default and site settings): | ||
| # ~/.spack/modules.yaml | ||
| # ------------------------------------------------------------------------- | ||
| modules: |
There was a problem hiding this comment.
if you want to overwrite the default within user space, it should be enough to write the section
modules:
enable:
- lmodin this file.
I would also check this file in only once in the directory above for all docker recipes.
There was a problem hiding this comment.
Good to know. Is there a way to reference files for COPY that lie outside the Dockerfile's current directory? It was my understanding that this wasn't possible. Hence, the duplicate copy.
| @@ -0,0 +1,24 @@ | |||
| uid="`id -u`" | |||
There was a problem hiding this comment.
isn't this file needed in fedora as well?
There was a problem hiding this comment.
Right. Fedora et al is coming, soon (TM),
| @@ -0,0 +1,47 @@ | |||
| # ------------------------------------------------------------------------- | |||
|
Uh, you might be right!
I usually softlink them in git, but that might cause troubles for Windows contributors.
|
|
@ax3l, I think you'll really like these latest additions. Unfortunately, github doesn't cope with my rebases well, so you should focus on the history in the actual branch -- not as it is shown on the PR. In addition to the changes you've suggested, I've also added arch and centos docker images, giving us 4 total distros to test and develop in. You can install spack packages from all four side-by-side within the same installation root; even simultaneously, if you really wanted to and could spare the memory! As you review, I'd like to point out specific commits:
$ docker-compose run --rm -e CUSTOM_PROMPT=1 ubuntu
It's too bad the way docker works forces us to duplicate some files, but once I've gotten over the minor headache of editing some things four times, I've come to really appreciate the convenience of developing across several distros with minimal effort. I think we're getting pretty close to a really nice development asset. Edit: Changed HEAD references to hashes so that they still work after adding more commits. |
3160279 to
9811cdd
Compare
ax3l
left a comment
There was a problem hiding this comment.
really nice work and well documented, thank you!
I tried it with docker-compose version 1.16.1, build 6d1ac21 + Docker version 1.6.2, build 7c8fca2 and are currently getting network errors. Is there anything I am missing?
| @@ -0,0 +1,59 @@ | |||
| FROM pritunl/archlinux | |||
There was a problem hiding this comment.
I appreciate the minimal image, but this image does not look too popular for arch.
Although there seems not to be an official arch image, there are certainly more popular and automated ones in: https://hub.docker.com/search/?isAutomated=1&isOfficial=0&q=arch
Shall we use one of those?
There was a problem hiding this comment.
Indeed, there doesn't seem to be an official arch image, and I went with the one I found mentioned in Arch's docker documentation. https://wiki.archlinux.org/index.php/Docker
I remember trying the base/archlinux image and having trouble with it, though I can't recall exactly what the issue was. In any case, I'll give these other images a try and report back.
There was a problem hiding this comment.
Well, I can't remember what problems I had before, but they seem to be gone, now! I'll go ahead and push up the change for the arch image's base to base/archlinux.
| $ docker-compose config --services | ||
| fedora | ||
| ubuntu | ||
| $ docker-compose run --rm fedora |
There was a problem hiding this comment.
somehow I get a
Creating network "spack_default" with the default driver
ERROR: 404 page not found
at this point :(
There was a problem hiding this comment.
I'm not sure what the 404 means, exactly, but the version of docker you reported is almost certainly too old. You will need a relatively recent version of the docker client and server in order for the different containers to work.
For comparison, this is what I get on my Macbook using the new docker for mac engine:
$ docker versionClient:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: darwin/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true
There was a problem hiding this comment.
Sorry for the long delay and thx for ping-ing!
I updated to
$ docker --version
Docker version 17.09.0-ce, build afdb6d4
$ docker-compose --version
docker-compose version 1.17.0, build ac53b73now... will report back in a few minutes :)
|
@ax3l LGTY? 🤞 |
|
@opadron install works so far like a charm for me! But did you try loading the installed packages? e.g. on fedora it fails for me: on ubuntu: # spack load zlib
Lmod Warning: MODULEPATH is undefined
Lmod has detected the following error:
The following module(s) are unknown: "zlib-1.2.11-clang-3.8.1-24-crspzo2" "zlib-1.2.11-gcc-5.4.1-5nuhji2" "zlib-1.2.11-gcc-6.3.1-dmwlk6z" "zlib-1.2.11-gcc-5.4.0-swly52a" "zlib-1.2.11-gcc-6.3.0-hwcs5w5"
Please check the spelling or version number. Also try "module spider ..." |
|
I'm inclined to call this a bug in Spack, because it runs counter to what I had come to expect as a Spack user. Considering that Spack doesn't seem to have a problem installing and reporting on installed packages from multiple distributions side-by-side (that is, within the same Spack database), it would seem to imply that Spack should be able to cope with such a situation when asked to load a module, but I have confirmed that this multi-distro scenario is what causes the various errors you are seeing. To test this yourself, just There is a simple workaround that I have already prepared where every distro uses a separate Spack DB, but I think we should have a discussion about the underlying issue before deciding that we want this workaround. /cc @tgamblin |
|
#6245 Seems to be related to the issue I wrote about above, which tells me at least one other person thinks this is a bug in Spack. If we're indeed willing to call this a bug in Spack, I would suggest that we continue to consider this PR for merging in spite of the bug. |
ax3l
left a comment
There was a problem hiding this comment.
all right from my side, besides the loading issue on multi arch installs which is an orthogonal issue
| python \ | ||
| sudo \ | ||
| tcl && \ | ||
| git clone --depth 1 git://github.com/llnl/spack.git /spack && \ |
There was a problem hiding this comment.
I think the urls should be updated.
alalazo
left a comment
There was a problem hiding this comment.
I took the time to go through the code, and I really like the idea of bind mounting volumes to get a light-weight multi-platform environment using docker.
@ax3l We have to distinguish between So, to summarize:
|
sorry for my short note, I was referring indeed to the |
"legacy" tcl... |
|
Thanks @opadron! |
* add docker-based development resources * incorporate feedback from @ax3l * fix docs/improve ssh handling * experiment with custom prompt * add arch/fix missing core_compilers key * add centos/minor tweaks * make prompt experiment optional * workaround problem with latest fedora docker image * add docker documentation page to index toc * try another documentation fix * switch arch linux base to base/archlinux * update the git urls in the Dockerfiles * add opensuse * switch CUSTOM_PROMPT variable to simply "PROMPT"
* add docker-based development resources * incorporate feedback from @ax3l * fix docs/improve ssh handling * experiment with custom prompt * add arch/fix missing core_compilers key * add centos/minor tweaks * make prompt experiment optional * workaround problem with latest fedora docker image * add docker documentation page to index toc * try another documentation fix * switch arch linux base to base/archlinux * update the git urls in the Dockerfiles * add opensuse * switch CUSTOM_PROMPT variable to simply "PROMPT"
Hi, folks!
Here's my docker-based development setup. It should be very easy to use, all you need is the latest versions of docker and docker-compose. There's a small README that explains the basic usage and there is support for running in a container running Ubuntu and Fedora, with more choices on the way if there is interest.
The code running spack in the container is the same as your local working copy, letting you experiment in a clean environment while you make changes. Installed packages show up under your local working copy under
./optand are shared and persist between multiple containers.We can merge, if enough people like this, or we can keep the branch as-is. The changes stand well enough on their own that they should be easy to cherry-pick.