ec2_post_init
Populate STScI EC2 instances with ease
docker.inc.sh File Reference

Docker functions. More...

Go to the source code of this file.

Functions

 docker_setup (user, bind_port)
 Install docker on the server. More...
 
 docker_user_add (user)
 Add a user account to the docker group. More...
 
 docker_pull_many (image...)
 Wrapper for docker pull More...
 

Detailed Description

Docker functions.

Example

#!/usr/bin/env bash
source ec2pinit.inc.sh
docker_setup "$USER"
docker_pull_many "centos:7" "centos:8"
for version in {7..8}; do
docker run --rm -it centos:${version} \
/bin/sh -c 'echo hello world from $(cat /etc/redhat-release)'
done
docker_setup(user, bind_port)
Install docker on the server.
Definition: docker.inc.sh:17
docker_pull_many(image...)
Wrapper for docker pull
Definition: docker.inc.sh:110

Definition in file docker.inc.sh.

Function Documentation

◆ docker_pull_many()

docker_pull_many ( image...  )

Wrapper for docker pull

Pull multiple docker images with a single command

Parameters
image...image to pull
images=(centos:7 centos:8)
docker_pull_many "${images[@]}"
# or
docker_pull_many "centos:7" "centos:8"

Definition at line 110 of file docker.inc.sh.

◆ docker_setup()

docker_setup ( user  ,
bind_port   
)

Install docker on the server.

Parameters
useraccount to add to docker group
bind_portbinds the docker daemon to a TCP port. When this option is enabled the user account argument is ignored in favor of setting DOCKER_HOST=tcp://127.0.0.1:${bind_port} at login

Definition at line 17 of file docker.inc.sh.

◆ docker_user_add()

docker_user_add ( user  )

Add a user account to the docker group.

Parameters
useran account to modify (must exist)

Definition at line 92 of file docker.inc.sh.