Docker

Docker is a popular system to generate containers based on Linux. The containers are like virtual machines but they require less resources and they are faster to setup. Docker is available for the following platforms:

There is a public docker image that can be used to run iSpec. It expects that the users already has iSpec downloaded in the directory '$HOME/iSpec'. Once the container is launched, the user can access his/her files in '$HOME/workspace/' and it can use the command 'ispec' to launch iSpec.

Linux

  • Add to the end of '$HOME/.bashrc' (set the GITNAME and GITEMAIL variables properly):
# Start container based on the astro image
docker_astro_container() {
    GITNAME="Your name"
    GITEMAIL="your_username@users.noreply.github.com"
    DOCKER_USERNAME="docker"

    docker run -it --rm \
            --detach-keys="ctrl-q,q" \
            --device /dev/fuse --cap-add SYS_ADMIN \
            -e DISPLAY=$DISPLAY \
            -v /tmp/.X11-unix:/tmp/.X11-unix \
            -e GITEMAIL="$GITEMAIL" -e GITNAME="$GITNAME" \
            -v $HOME:/home/$DOCKER_USERNAME/workspace \
            -v $HOME/iSpec:/home/$DOCKER_USERNAME/iSpec \
            marblestation/astro
}

# Kill all running containers.
alias docker_killall='printf "\n>>> Killing all containers\n\n" && docker kill $(docker ps -q)'

# Stop all running containers.
alias docker_stopall='printf "\n>>> Stoping all containers\n\n" && docker stop $(docker ps -q)'

# List all containers and images.
alias docker_listall='printf "\n>>> List all containers\n\n" && docker ps -a && printf "\n>>> List all containers\n\n" && docker images'

# Delete all stopped containers.
alias docker_clean_containers='printf "\n>>> Deleting stopped containers\n\n" && docker rm -v $(docker ps -a -q -f status=exited)'

# Delete all untagged images.
alias docker_clean_images='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'

# Delete all stopped containers and untagged images.
alias docker_clean='docker_clean_containers || true && docker_clean_images'
  • Load the new configuration:
    source $HOME/.bashrc
  • Run the image:
    docker_astro_container

OSX

  • Install XQuartz (minimum 2.7.11)
  • Open XQuartz: open -a XQuartz
    1. Update preferences 'Security' tab - turn on 'Allow connection from network clients'
    2. Restart XQuartz and then check to see that it is listening on port 6000: lsof -i :6000
  • Add to the end of '$HOME/.bashrc' (set the GITNAME and GITEMAIL variables properly):
# Start container based on the astro image
docker_astro_container() {
    GITNAME="Your name"
    GITEMAIL="your_username@users.noreply.github.com"
    DOCKER_USERNAME="docker"

    DOCKER_IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
    xhost + $DOCKER_IP

    docker run -it --rm \
            --detach-keys="ctrl-q,q" \
            --device /dev/fuse --cap-add SYS_ADMIN \
            -e DISPLAY=$DOCKER_IP:0 \
            -e GITEMAIL="$GITEMAIL" -e GITNAME="$GITNAME" \
            -v $HOME:/home/$DOCKER_USERNAME/workspace \
            -v ${HOME}/.ssh/id_rsa:/home/$DOCKER_USERNAME/.ssh/id_rsa:ro \
            -v $HOME/iSpec:/home/$DOCKER_USERNAME/iSpec \
            marblestation/astro
}

# Kill all running containers.
alias docker_killall='printf "\n>>> Killing all containers\n\n" && docker kill $(docker ps -q)'

# Stop all running containers.
alias docker_stopall='printf "\n>>> Stoping all containers\n\n" && docker stop $(docker ps -q)'

# List all containers and images.
alias docker_listall='printf "\n>>> List all containers\n\n" && docker ps -a && printf "\n>>> List all containers\n\n" && docker images'

# Delete all stopped containers.
alias docker_clean_containers='printf "\n>>> Deleting stopped containers\n\n" && docker rm -v $(docker ps -a -q -f status=exited)'

# Delete all untagged images.
alias docker_clean_images='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'

# Delete all stopped containers and untagged images.
alias docker_clean='docker_clean_containers || true && docker_clean_images'
  • Load the new configuration:

    source $HOME/.bashrc
  • Run the image:

    docker_astro_container

Windows

Not tested.