Skip to content

Commit b7b0ed0

Browse files
undutetron
authored andcommitted
Stop using Docker in Docker for container image (#690)
* maintenance: ignore some folders whith docker * feature: simplify Dockerfiles * fix: copy python libs correctly to image * maintenance: make container to work in scripts Because the tool containers are created by the host now, the folder where the results are stored in the host needs to be mounted to the cwltool container now. * maintenance: update dockerfile metadata MAINTAINER is deprecated, use LABEL instead * fix: add wrapper to launch docker in a container Adds 2 checks to see if it was correctly launched * fix: enable build for cwltool_module image * maintenance: remove trailing whitespace from windows doc * maintenance: remove extraneous line from cwl-docker.sh
1 parent 5eb04a6 commit b7b0ed0

File tree

8 files changed

+65
-173
lines changed

8 files changed

+65
-173
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.tox/
2+
.eggs/
3+
.vscode/
4+
build/
5+
dist/
6+
*.Dockerfile

build-cwl-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
set -e
3-
docker build --file=cwltool_module.Dockerfile --tag=commonworkflowlanguage/cwltool_module .
3+
docker build --file=cwltool.Dockerfile --tag=commonworkflowlanguage/cwltool-module --target module .
44
docker build --file=cwltool.Dockerfile --tag=commonworkflowlanguage/cwltool .

cwl-docker.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/bin/sh
2-
docker run --name=cwl-docker -v /var/lib/docker -i -t fedora-data true
3-
docker run --privileged -ti --volume=$PWD:$PWD -w=$PWD commonworkflowlanguage/cwltool $@
2+
exec docker run -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp -v "$PWD":"$PWD" -w="$PWD" commonworkflowlanguage/cwltool "$@"

cwltool-in-docker.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env sh
2+
if [ ! -S /var/run/docker.sock ]; then
3+
>&2 echo 'ERROR: cwltool cannot work inside a container without access to docker'
4+
>&2 echo 'Launch the container with the option -v /var/run/docker.sock:/var/run/docker.sock'
5+
exit 1
6+
elif [ "$PWD" = '/error' ]; then
7+
>&2 echo 'ERROR: cwltool cannot work without access to the current path'
8+
>&2 echo 'Launch the container with the options -v "$PWD":"$PWD" -w="$PWD"'
9+
exit 1
10+
else
11+
cwltool "$@"
12+
fi

cwltool.Dockerfile

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1-
FROM commonworkflowlanguage/cwltool_module
2-
3-
4-
# Let's start with some basic stuff.
5-
RUN apt-get update -qq && apt-get install -qqy \
6-
apt-transport-https \
7-
ca-certificates \
8-
curl \
9-
lxc \
10-
iptables \
11-
python-setuptools
12-
13-
# Install Docker from Docker Inc. repositories.
14-
RUN curl -sSL https://get.docker.com/ | sh
15-
16-
# Install the magic wrapper.
17-
ADD ./wrapdocker /usr/local/bin/wrapdocker
18-
RUN chmod +x /usr/local/bin/wrapdocker
19-
20-
VOLUME /var/lib/docker
21-
ENTRYPOINT ["wrapdocker", "cwltool"]
1+
FROM python:3.6-alpine as builder
2+
3+
RUN apk add --no-cache git
4+
5+
WORKDIR /cwltool
6+
COPY . .
7+
8+
RUN python setup.py bdist_wheel --dist-dir=/wheels
9+
RUN pip wheel -r requirements.txt --wheel-dir=/wheels
10+
RUN pip install --no-index --no-warn-script-location --root=/pythonroot/ /wheels/*.whl
11+
12+
FROM python:3.6-alpine as module
13+
LABEL maintainer [email protected]
14+
15+
RUN apk add --no-cache docker nodejs
16+
COPY --from=builder /pythonroot/ /
17+
18+
FROM python:3.6-alpine
19+
LABEL maintainer [email protected]
20+
21+
RUN apk add --no-cache docker nodejs
22+
COPY --from=builder /pythonroot/ /
23+
COPY cwltool-in-docker.sh /cwltool-in-docker.sh
24+
25+
WORKDIR /error
26+
27+
ENTRYPOINT ["/cwltool-in-docker.sh"]

cwltool_module.Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

windowsdoc.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Quickstart Terminal.
1717

1818
## Installation
1919

20-
You can install cwltool using pip or directly from source code.
20+
You can install cwltool using pip or directly from source code.
2121

2222
### Requirements
2323

@@ -37,13 +37,13 @@ pip install cwltool
3737
### Install from source
3838

3939
```
40-
git clone https://github.com/common-workflow-language/cwltool.git
41-
cd cwltool
40+
git clone https://github.com/common-workflow-language/cwltool.git
41+
cd cwltool
4242
pip install .
4343
```
4444

4545
***Note:*** In order to test if cwltool has been successfully installed on your
46-
Windows system, run `cwltool` in `cmd`. If you see help instructions, cwltool was successfully installed.
46+
Windows system, run `cwltool` in `cmd`. If you see help instructions, cwltool was successfully installed.
4747

4848
```
4949
CWL document required, no input file was provided
@@ -78,12 +78,12 @@ python setup.py test
7878
To run the CWL conformance tests, follow these instructions:
7979

8080
```
81-
pip install cwltest mock
82-
git clone https://github.com/common-workflow-language/common-workflow-language.git
83-
cd common-workflow-language/v1.0
81+
pip install cwltest mock
82+
git clone https://github.com/common-workflow-language/common-workflow-language.git
83+
cd common-workflow-language/v1.0
8484
cwltest --test conformance_test_v1.0.yaml -j 4 --tool cwltool
8585
```
86-
The `-j` options is used to run multiple tests in parallel.
86+
The `-j` options is used to run multiple tests in parallel.
8787

8888
## Troubleshooting
8989

@@ -97,19 +97,19 @@ consulting the [online Docker Community](https://forums.docker.com/).
9797

9898
### Your local drives are not being shared with Docker Containers
9999

100-
* ***On native Docker for Windows (supported by Windows 10):***
101-
On your tray, next to your clock, right-click on Docker, then click on Settings,
102-
there you'll find the shared rdives: Here you can share your drives with Docker.
100+
* ***On native Docker for Windows (supported by Windows 10):***
101+
On your tray, next to your clock, right-click on Docker, then click on Settings,
102+
there you'll find the shared rdives: Here you can share your drives with Docker.
103103
If you encounter a problem with your firewall, please
104104
[refer this to post](https://blog.olandese.nl/2017/05/03/solve-docker-for-windows-error-a-firewall-is-blocking-file-sharing-between-windows-and-the-containers/).
105105

106-
* ***On Docker Toolbox:***
107-
Docker Toolbox uses Virtualbox to create a linux base on which Docker machine runs.
108-
Your Docker Container will be created inside Virtualbox. To share drives
106+
* ***On Docker Toolbox:***
107+
Docker Toolbox uses Virtualbox to create a linux base on which Docker machine runs.
108+
Your Docker Container will be created inside Virtualbox. To share drives
109109
in virtualbox, go to ****Virtualbox->settings->shared folders->Machine Folders****
110-
Here Map the drives you want to share with your Docker Container.
111-
If you want to keep these settings permanent (Recommended!), You should mark the
112-
`make permanent` checkbox or else these settings will be erased every time your
110+
Here Map the drives you want to share with your Docker Container.
111+
If you want to keep these settings permanent (Recommended!), You should mark the
112+
`make permanent` checkbox or else these settings will be erased every time your
113113
virtualbox closes.
114114

115115
### In a Docker Container with shared drives, not all files are shown on `ls`
@@ -127,7 +127,7 @@ on your local machine, you should be able to write to that folder inside Docker
127127
Container also (provided same user initiated Docker). In all it is a file
128128
permission issue.
129129

130-
### Workflows with Javascript Expressions occasionally give Timeout errors
130+
### Workflows with Javascript Expressions occasionally give Timeout errors
131131
To evaluate Javascript Expressions, cwltool looks for Nodejs on your system.
132132
In case Nodejs isn't installed, JS expressions are executed in a Docker Container.
133133
In order to avoid waiting forever in case error occurs, cwltool times out js

wrapdocker

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)