Skip to content

Commit c4dd0de

Browse files
committed
running container without args shouldnt be error return code
2 parents faaad75 + 7db3c0a commit c4dd0de

File tree

6 files changed

+215
-12
lines changed

6 files changed

+215
-12
lines changed

.circleci/config.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# This is a continuous build CircleCI configuration for a Docker container
2+
# intended to bulid on CircleCI to spread out testing over Travis/Circle.
3+
# The container is built and pushed to the CONTAINER_NAME variable
4+
# defined here or within the CircleCI settings. The following environment
5+
# variables are acceptable here or in these settings (for sensitive information)
6+
#
7+
# CONTAINER_NAME
8+
# DOCKER_USER
9+
# DOCKER_EMAIL
10+
11+
################################################################################
12+
# Functions
13+
################################################################################
14+
15+
# Defaults
16+
17+
defaults: &defaults
18+
docker:
19+
- image: docker:18.01.0-ce-git
20+
working_directory: /tmp/src
21+
environment:
22+
- CONTAINER_NAME: singularityware/docker2singularity
23+
24+
# Installation
25+
26+
install: &install
27+
name: Install parallel gzip, gettext, python3, and jq
28+
command: apk add --no-cache pigz python3 gettext jq
29+
30+
31+
dockerload: &dockerload
32+
name: Load Docker container Image
33+
no_output_timeout: 30m
34+
command: |
35+
echo "Working directory is ${PWD}"
36+
docker info
37+
set +o pipefail
38+
if [ -f /tmp/cache/container.tar.gz ]; then
39+
apk update && apk add --no-cache pigz curl curl-dev
40+
pigz -d --stdout /tmp/cache/container.tar.gz | docker load
41+
fi
42+
43+
44+
dockersave: &dockersave
45+
name: Docker Save
46+
no_output_timeout: 40m
47+
command: |
48+
DOCKER_TAG="v$(cat VERSION)"
49+
echo "Saving ${CONTAINER_NAME}:${DOCKER_TAG} to container.tar.gz"
50+
mkdir -p /tmp/cache
51+
docker save ${CONTAINER_NAME}:${DOCKER_TAG} \
52+
| pigz -2 -p 3 > /tmp/cache/container.tar.gz
53+
54+
55+
dockerdeploy: &dockerdeploy
56+
name: Deploy to Docker Hub
57+
no_output_timeout: 40m
58+
command: |
59+
docker images
60+
DOCKER_TAG="v$(cat VERSION)"
61+
echo "Container name set to ${CONTAINER_NAME}:${DOCKER_TAG}"
62+
if [[ -n "$DOCKER_PASS" ]]; then
63+
docker login -u $DOCKER_USER -p $DOCKER_PASS
64+
docker push ${CONTAINER_NAME}:${DOCKER_TAG}
65+
echo "Tagging latest image..."
66+
docker tag ${CONTAINER_NAME}:${DOCKER_TAG} ${CONTAINER_NAME}:latest
67+
docker push ${CONTAINER_NAME}:latest
68+
fi
69+
70+
dockerbuild: &dockerbuild
71+
name: Build development Docker container
72+
command: |
73+
echo "Building base image..."
74+
DOCKER_TAG="v$(cat VERSION)"
75+
docker build -t ${CONTAINER_NAME}:${DOCKER_TAG} .
76+
77+
################################################################################
78+
# Jobs
79+
################################################################################
80+
81+
82+
version: 2
83+
jobs:
84+
build:
85+
<<: *defaults
86+
steps:
87+
- checkout
88+
- restore_cache:
89+
keys:
90+
- docker-v1-{{ .Branch }}
91+
paths:
92+
- /tmp/cache/container.tar.gz
93+
- restore_cache:
94+
key: dependency-cache
95+
- setup_remote_docker
96+
- run: *install
97+
- run: *dockerload
98+
- run: *dockerbuild
99+
- run: *dockersave
100+
- persist_to_workspace:
101+
root: /tmp
102+
paths:
103+
- src
104+
- cache
105+
106+
update_cache:
107+
<<: *defaults
108+
steps:
109+
- attach_workspace:
110+
at: /tmp
111+
- save_cache:
112+
key: docker-v1-{{ .Branch }}
113+
paths:
114+
- /tmp/cache/container.tar.gz
115+
116+
deploy:
117+
<<: *defaults
118+
steps:
119+
- attach_workspace:
120+
at: /tmp
121+
- setup_remote_docker
122+
- run: *dockerload
123+
- run: *dockerdeploy
124+
125+
126+
################################################################################
127+
# Workflows
128+
################################################################################
129+
130+
131+
workflows:
132+
version: 2
133+
build_deploy:
134+
jobs:
135+
- build:
136+
filters:
137+
branches:
138+
ignore:
139+
- gh-pages
140+
- /docs?/.*/
141+
tags:
142+
only: /.*/
143+
144+
- update_cache:
145+
requires:
146+
- build
147+
filters:
148+
branches:
149+
ignore:
150+
- gh-pages
151+
- /docs?/.*/
152+
tags:
153+
only: /.*/
154+
155+
# Upload the container to Docker Hub
156+
- deploy:
157+
requires:
158+
- build
159+
- update_cache
160+
filters:
161+
branches:
162+
only: master
163+
tags:
164+
only: /.*/

AUTHORS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Maintainers
2+
3+
- [@chrisfilo](https://www.github.com/chrisfilo)
4+
- [@vsoch](https://www.github.com/vsoch)
5+
6+
## Contributors
7+
8+
- [@pvanheus](https://www.github.com/pvanheus)
9+
- [@kaczmarj](https://www.github.com/kaczmarj)
10+
- [@alanhoyle](https://www.github.com/alanhoyle)
11+
- [@justbennet](https://www.github.com/justbennet)
12+
- [@pditommaso](https://www.github.com/pditommaso)
13+
- [@jdidion](https://www.github.com/jdidion)
14+
- [@alaindomissy](https://www.github.com/alaindomissy)

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ represented by the pull requests that fixed them. Critical items to know are:
1313
- changed behaviour (recipe sections work differently)
1414

1515
This changelog was started with version of Singularity v2.5, and reflects changes since then.
16+
The tags here reflect tags on Docker Hub
1617

1718
## [master](https://github.com/singularityware/docker2singularity/tree/master) (master)
1819
- update of Singularity from [v2.5](https://github.com/singularityware/docker2singularity/tree/v2.5) to [v2.6](https://github.com/singularityware/docker2singularity/tree/v2.6), including adding libarchive dependency, and custom name with -n (v2.6)
19-
- update of Singularity from [v2.4](https://github.com/singularityware/docker2singularity/tree/v2.4) to [v2.5](https://github.com/singularityware/docker2singularity/tree/v2.5), including adding libarchive dependency, and custom name with -n (v2.5)
20+
- addition of automated builds via CircleCI, and Authors.md (v2.5)
21+
- update of Singularity from [v2.4](https://github.com/singularityware/docker2singularity/tree/v2.4) to [v2.5](https://github.com/singularityware/docker2singularity/tree/v2.5), including adding libarchive dependency, and custom name with -n

README.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# `docker2singularity`
22

3-
Are you developing Docker images and you would like to run them on an HPC cluster supporting [Singularity](http://singularity.lbl.gov)? Are you working on Mac or Windows with no easy access to a Linux machine? If the pull, import, and general commands to [work with docker images provided by Singularity](http://singularity.lbl.gov/docs-docker) natively do not fit your needs, `docker2singularity` is an alternative way to generate Singularity images. This particular branch is intended for Singularity 2.4, which gives you a selection of image formats to build.
3+
4+
<img src="https://camo.githubusercontent.com/49f33b2464042e323b43dfb587323f80d2329840/68747470733a2f2f7777772e73796c6162732e696f2f6775696465732f322e352e312f757365722d67756964652f5f7374617469632f6c6f676f2e706e67" alt="https://www.sylabs.io/guides/2.5.1/user-guide/_static/logo.png" data-canonical-src="https://www.sylabs.io/guides/2.5.1/user-guide/_static/logo.png" width="200" height="200">
5+
6+
[![CircleCI](https://circleci.com/gh/singularityware/docker2singularity.svg?style=svg)](https://circleci.com/gh/singularityware/docker2singularity)
7+
8+
Are you developing Docker images and you would like to run them on an HPC cluster
9+
supporting [Singularity](https://www.sylabs.io/guides/2.5.1/user-guide/introduction.html)?
10+
Are you working on Mac or Windows with no easy access to a Linux machine? If the pull,
11+
build, and general commands to [work with docker images provided by Singularity](https://www.sylabs.io/guides/2.5.1/user-guide/singularity_and_docker.html?highlight=docker) natively do not fit your needs,
12+
`docker2singularity` is an alternative way to generate Singularity images.
13+
This particular branch is intended for Singularity 2.5.1, which gives you a selection of image formats to build.
14+
The containers are also available for you on [Docker Hub](https://hub.docker.com/r/singularityware/docker2singularity/).
415

516
## Usage
617

7-
```
8-
docker run docker2singularity
18+
```bash
19+
docker run singularityware/docker2singularity
920
USAGE: docker2singularity [-m "/mount_point1 /mount_point2"] [options] docker_image_name
1021
OPTIONS:
1122

@@ -145,7 +156,7 @@ meatballs.simg
145156
## Inspect Your Image
146157
New with `docker2singularity` 2.4, the labels for the container are available with `inspect`:
147158

148-
```
159+
```bash
149160
singularity inspect ubuntu_14.04-2017-09-13-3e51deeadc7b.simg
150161
{
151162
"org.label-schema.singularity.build": "squashfs",
@@ -161,7 +172,7 @@ New with `docker2singularity` 2.4, the labels for the container are available wi
161172

162173
as is the runscript and environment
163174

164-
```
175+
```bash
165176
singularity inspect --json -e -r ubuntu_14.04-2017-09-13-3e51deeadc7b.simg
166177
{
167178
"data": {
@@ -178,7 +189,7 @@ singularity inspect --json -e -r ubuntu_14.04-2017-09-13-3e51deeadc7b.simg
178189
## Build a Sandbox Image
179190
A sandbox image is a folder that is ideal for development. You can view it on your desktop, cd inside and browse, and it works like a Singularity image. To create a sandbox, specify the `-f` flag:
180191

181-
```
192+
```bash
182193
docker run -v /var/run/docker.sock:/var/run/docker.sock \
183194
-v /host/path/change/me:/output \
184195
--privileged -t --rm \
@@ -188,14 +199,14 @@ ubuntu:14.04
188199
```
189200
Importantly, you can use `--writable`, and if needed, you can convert a sandbox folder into a production image:
190201

191-
```
202+
```bash
192203
sudo singularity build sandbox/ production.simg
193204
```
194205

195206
## Build a Legacy (ext3) Image
196207
You can build a legacy ext3 image (with `--writable`) with the `-w` flag. This is an older image format that is more prone to degradation over time, and (building) may not be supported for future versions of the software.
197208

198-
```
209+
```bash
199210
docker run -v /var/run/docker.sock:/var/run/docker.sock \
200211
-v /host/path/change/me:/output \
201212
--privileged -t --rm \
@@ -205,9 +216,10 @@ ubuntu:14.04
205216
```
206217
You can also use `--writable` and convert an ext3 image into a production image:
207218

208-
```
219+
```bash
209220
sudo singularity build ext3.img production.simg
210221
```
222+
211223
### Contributed Examples
212224
The following are a list of brief examples and tutorials generated by the Singularity community for using **docker2singularity**. If you have an example of your own, please [let us know](https://www.github.com/singularityware/docker2singularity/issues)!
213225

@@ -226,32 +238,42 @@ The following are a list of brief examples and tutorials generated by the Singul
226238
- Don’t use the USER instruction set
227239

228240
## FAQ
241+
Here are some frequently asked questions if you run into trouble!
242+
229243
### "client is newer than server" error
230244
If you are getting the following error:
231245
`docker: Error response from daemon: client is newer than server`
232246

233247
You need to use the `docker info` command to check your docker version and use it to grab the correct corresponding version of `docker2singularity`. For example:
234248

249+
```bash
235250
docker run \
236251
-v /var/run/docker.sock:/var/run/docker.sock \
237252
-v D:\host\path\where\to\output\singularity\image:/output \
238253
--privileged -t --rm \
239254
singularityware/docker2singularity:1.11 \
240255
ubuntu:14.04
256+
```
241257

242258
Currently only the 1.10, 1.11, 1.12, and 1.13 versions are supported. If you are using an older version of Docker you will need to upgrade.
243259

244260

245261
### My cluster/HPC requires Singularity images to include specific mount points
246262
If you are getting `WARNING: Non existant bind point (directory) in container: '/shared_fs'` or a similar error when running your Singularity image that means that your Singularity images require custom mount points. To make the error go away you can specify the mount points required by your system when creating the Singularity image:
247263

264+
```bash
248265
docker run \
249266
-v /var/run/docker.sock:/var/run/docker.sock \
250267
-v D:\host\path\where\to\output\singularity\image:/output \
251268
--privileged -t --rm \
252269
singularityware/docker2singularity \
253270
-m "/shared_fs /custom_mountpoint2" \
254271
ubuntu:14.04
272+
```
255273

256274
## Acknowledgements
257-
This work is heavily based on the `docker2singularity` work done by [vsoch](https://github.com/vsoch) and [gmkurtzer](https://github.com/gmkurtzer). Hopefully most of the conversion code will be merged into Singularity in the future making this container even leaner!
275+
276+
This work is heavily based on the `docker2singularity` work done by [vsoch](https://github.com/vsoch)
277+
and [gmkurtzer](https://github.com/gmkurtzer). The original record of the work can be read about
278+
in [this commit](https://github.com/singularityware/docker2singularity/commit/d174cadefd90f77f302f4bef5a8cd089eb2da2e4).
279+
Thank you kindly to all the contributors, and please open an issue if you need help.

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6

docker2singularity.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function usage() {
5555
# --- Option processing --------------------------------------------
5656
if [ $# == 0 ] ; then
5757
usage
58-
exit 1;
58+
exit 0;
5959
fi
6060

6161
mount_points="/oasis /projects /scratch /local-scratch /work /home1 /corral-repl /corral-tacc /beegfs /share/PI /extra /data /oak"

0 commit comments

Comments
 (0)