Wednesday 5 March 2014

Docker Notes - setting up a lisp container

These notes are to help serve as a reminder for how I setup / played with Docker to host a lisp environment client.

In a new directory create a file called 'Dockerfile' and populate as follows:

FROM centos
MAINTAINER Stephen Shorrock
# Install sbcl
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RUN yum install -y sbcl


Then in that same directory build the docker image/container:

docker build -t="sbcl" ./

Once built run the container as a new bash shell:

docker run -i -t sbcl /bin/bash

start lisp:

sbcl

or run the sbcl interpreter striaght away:

docker run -i -t sbcl sbcl

You could even run a lisp script on the local drive by mounting a path, eg if your script was /tmp/myscripts/script1.lisp

eg (content of /tmp/myscripts/script1.lisp)

(write-line "Hello, World!")


docker run -i -v /tmp/myscripts:lisp_scripts -t sbcl sbcl --script lisp_scripts/script1.lisp

#: Hello, World!

 ...

once finished exit lisp

(quit)

and quit the docker container:

Ctrl-P Ctrl-Q


To attach back into the container, find the id of the running container

sudo docker ps

Then attach back:

sudo docker attach










No comments:

Post a Comment