...
2. Click on the icon for the Quickstart Terminal window to launch it from the Application/Docker folder. Verify the installation by running the hello-world container.
$docker - run hello-world
If Quickstart Terminal startup script did not configure the shell correctly, you may get message “docker: cannot connect to the Docker daemon. Is the docker daemon running on this host?.”
...
- git clone https://opensource.ncsa.illinois.edu/bitbucket/scm/bd/path/to/template_converter.git
- Or, Download the template project from the repository: https://opensource.ncsa.illinois.edu/bitbucket/projects/BD/repos/path/to/templatemplatetemplate_converter
The template-converter directory consists of one file (docker-compose.yml), and one sub-directory, example-server , with two files: Dockerfile and ImageMagick_convert.sh.
...
Step 4: Testing the example-server
- Open another docker terminal
Open Kitematic, press button 'DOCKER CLI' in bottom-left corner
- Change to the example-server directory:
...
- Make sure the permission for ImageMagick_convert.sh is 755.
$cd chmod $chmod 755 ImageMagick_convert.sh
- Build and launch the example software server with the converter
$docker build –t -t example-server .
$docker run --rm -t -i --link polyglotimageconverter_rabbitmq_1:rabbitmq example-server
...
$mv ImageMagick_convert.sh MyTool_convert.sh
- Modify the MyTool_converconvert.sh using any editor (e.g. vim). A simple example is shown below:
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/sh |
...
#ImageMagick (v6.5.2) |
...
#image |
...
#png bmp foobar |
...
#jpg output_filename=$(basename "$2") |
...
output_format="${output_filename##*.}" |
...
#Output PGM files as ASCII if [ "$output_format" = "pgm" ]; then |
...
convert "$1" -compress none "$2" |
...
else convert "$1" "$2" |
...
fi |
Line 2 : Change ImageMagick to MyTool
...
- Modify Dockerfile file using any editor (e.g. vim):
1 # Create softwareserver for polyglot.
2 FROM ncsa/polyglot-server:latest
3 MAINTAINER Rob Kooper <kooper@illinois.edu>
4
5 USER root
6 # - install requirements
7 # - enable shellscripts to be scanned
8 # - enable imagemagick conversion by adding to .aliases.txt
9 RUN apt-get update && apt-get -y install imagemagick && \
10 /bin/sed -i -e 's/^\([^#]*Scripts=\)/#\1/' -e 's/^#\(ShellScripts=\)/\1/' /home/polyglot/polyglot/SoftwareServer.conf && \
11 echo "ImageMagick" > /home/polyglot/polyglot/scripts/sh/.aliases.txt
12
13 # copy convert file to scripts/sh folder in container
14 # this is done to keep cache so you can debug script easily
15 COPY ImageMagick_convert.sh /home/polyglot/polyglot/scripts/sh/
16
17 # back to polyglot
18 USER polyglot
19 CMD ["softwareserver"]
Line 11: Add MyTool to the .aliases.txt
Modify:
echo "ImageMagick" > /home/polyglot/polyglot/scripts/sh/.aliases.txt
...
To
echo "MyTool" > /home/polyglot/polyglot/scripts/sh/.aliases.txt
...
Line 15: Copy MyTool_convert.sh script to the script directory
COPY MyTool_convert.sh /home/polyglot/polyglot/scripts/sh/
...
Save the file
...
- To build, launch and test the new converter, run the following command:
$docker build –t mytool .
$docker run --rm -t -i --link polyglot_rabbitmq_1:rabbitmq mytool