Notes of Docker

VirtualBox-5.1.14-112924-Win.exe -msiparams NETWORKTYPE=NDIS5
docker-machine create --virtualbox-disk-size 40000 -d virtualbox mplescano

docker-machine create --vmwareworkstation-disk-size 40000 -d vmwareworkstation mplescano

docker run -it --name iif_innovator_c --privileged -p 9088:9088 -p 9089:9089 -p 27017:27017 -p 27018:27018 -p 27883:27883 -e LICENSE=accept ibmcom/informix-innovator-c:latest

#see https://github.com/docker/kitematic/wiki/Common-Proxy-Issues-&-Fixes
#see http://www.netinstructions.com/how-to-install-docker-on-windows-behind-a-proxy/ (incomplete)
#Here I prefer to put ENV http_proxy=http://example.com:8080 in the docker file
docker-machine create -d virtualbox \
    --engine-env HTTP_PROXY=http://example.com:8080 \
    --engine-env HTTPS_PROXY=https://example.com:8080 \
    --engine-env NO_PROXY=example2.com \
    default
	
	
#use SCP to copy certificates
#see https://github.com/docker/machine/issues/1799
#see https://github.com/boot2docker/boot2docker#installing-secure-registry-certificates
#see https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them
#see docker-machine scp --help
$ docker-machine scp localhost:/D/Users/njoaquin.programador/Downloads/SUNATCA_autosigned.X_509.base64.cer mplescano:sunatca.crt
$ docker-machine ssh mplescano
$ sudo mkdir /var/lib/boot2docker/certs
$ sudo mv sunatca.crt /var/lib/boot2docker/certs/
$ docker-machine restart mplescano

#################################################
#in order to push images, it's necessary to copy the CA cert in others folders..
#Log docker: /var/log/docker.log
#hostDir: /etc/docker/certs.d/index.docker.io, /etc/docker/certs.d/docker.io
#for root see http://stackoverflow.com/questions/32646952/docker-machine-boot2docker-root-password
sudo -i
mkdir /etc/docker/certs.d
mkdir /etc/docker/certs.d/index.docker.io
mkdir /etc/docker/certs.d/docker.io
mkdir /etc/docker/certs.d/registry-1.docker.io
sudo ln -s /var/lib/boot2docker/certs/sunatca.crt /etc/docker/certs.d/index.docker.io/sunatca.crt
sudo ln -s /var/lib/boot2docker/certs/sunatca.crt /etc/docker/certs.d/docker.io/sunatca.crt
sudo ln -s /var/lib/boot2docker/certs/sunatca.crt /etc/docker/certs.d/registry-1.docker.io/sunatca.crt



#this doesnt work and doesnt persist if it's restarted the docker-machine
#cat /usr/local/etc/ca-certificates.conf
#/usr/local/share/ca-certificates/mozilla/, /usr/local/share/ca-certificates/extra/
sudo mkdir /usr/local/share/ca-certificates/extra/
sudo cp /var/lib/boot2docker/certs/sunatca.crt /usr/local/share/ca-certificates/extra/
sudo ln -s /var/lib/boot2docker/certs/sunatca.crt /usr/local/share/ca-certificates/extra/sunatca.crt
sudo echo "extra/sunatca.crt" >> /usr/local/etc/ca-certificates.conf

#start a session login
docker -D -l debug --tlsverify=false login --username=mplescano
########################################################

#use bash of git in windows
#Delete all container in exited status
docker rm $(docker ps -a|grep ".*Exited.*"|awk "{print \$1}")
#Delete all container in created status
docker rm $(docker ps -a|grep ".*Created.*"|awk "{print \$1}")
#delete images
docker rmi $(docker images | grep "^" | awk "{print \$3}")


########################################################

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s