This repository contains the notes about the Docker training for the support team.
We will use brew and cask as package manager on osx. Think of them az osx version of yum or apt-get. If you don’t have them:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask
If you have them make sure, you have the latest version:
brew update
Altaugh there is already docker-machine available, cloudbreak still has a dependency on boot2docker, so let’s stick boot2docker (b2d):
brew cask install virtualbox
brew install docker
brew install boot2docker
Correct versions should be:
boot2docker version : 1.8.0docker --version : 1.9.1Boot2docker can refer to 3 different thing:
Its important to give b2d enough resources:
boot2docker init --cpus=4 --disksize=30000 --memory=8192
Now you can start it:
boot2docker start
You can do it an individual terminal session:
eval "$(boot2docker shellinit)"
or I advise to put it into your profile:
cat >> ~/.bash_profile << EOF
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=$HOME/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
EOF
You can test it by: docker ps
Usefull aliases:
alias docker-kill-all='docker rm -f $(docker ps -aq)'
alias dps='docker ps'
alias dpsa='docker ps -a'
...
docker run -it centos
Nginx is not in the official repo, so we need to add a custom repo.
cat > /etc/yum.repos.d/nginx.repo <<'EOF'
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
EOF
Now we can install it:
yum update
yum install -y nginx
The command nginx starts the master and worker process in the background:
nginx
Lets test it:
curl 127.0.0.1
cat > /usr/share/nginx/html/index.html <<EOF
<h1> almost lunch time </h1>
EOF
test it again: curl 127.0.0.1
Detaching from a container means: Jumping out of a container back to the host: CTRL-P followed by a CTRL-Q.
First lets rename the container to name we all can refer to:
docker rename $(docker ps -lq) cent1
Now we can jump in:
docker attach cent1
Inside of cent1:
ip -o -4 a
docker commit cent1 lunch
list images:
docker images
Content type
Image
Digest
Size
3.6 MB
Last updated
almost 11 years ago
docker pull sequenceiq/docker-training:v4