How To Docker
How To Docker
How To Docker
```sh
http_proxy="http://10.144.1.11:8080/"
https_proxy="http://10.144.1.11:8080/"
no_proxy="localhost,instance-data,127.0.0.1,169.254.169.254,.nsn-net.net,.ext.ne
t.nokia.com,.inside.nsn.com,.int.net.nokia.com,.inside.nokiasiemensnetworks.com"
export http_proxy https_proxy no_proxy
```
# Prepare for installation, update, base pack, install docker
```sh
apt-get update && \
apt-get install -y htop zip unzip nano cifs-utils screen && \
wget -qO- https://get.docker.com/ | sh
```
## DOCKER PROXY ERROR ##
```sh
mkdir /etc/systemd/system/docker.service.d
bash -c 'cat <<EOF >> /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://10.144.1.11:8080/"
EOF
'
systemctl daemon-reload
systemctl show docker --property Environment
systemctl restart docker
```
## TEST IF NEEDED : $ docker run hello-world
#### ENABLE DOCKER SOCKET FOR THE API ####
```sh
bash -c 'cat <<EOF >> /etc/systemd/system/docker-tcp.socket
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service
[Install]
WantedBy=sockets.target
EOF
'
systemctl enable docker-tcp.socket
systemctl enable docker.socket
systemctl stop docker
systemctl start docker-tcp.socket
systemctl start docker
```
#### TEST IT WITH: ```sh docker -H tcp://127.0.0.1:2375 ps ```
# If euca is buzi, need to update /etc/resolv.conf file ...
```sh
cat <<EOF >> /etc/resolv.conf
domain eucalyptus.internal
search eucalyptus.internal americas.nsn-net.net. apac.nsn-net.net. china.nsn-net
.net. emea.nsn-net.net.
nameserver 10.135.72.108
EOF
```
# Stay in your root folder ( or cd there ) , like '/root' and type :
```sh
git clone https://gofree:[email protected]/alfoldi/laraDocke
r.git && \
cd laraDocker && \
git clone -b test_server https://gofree:[email protected]/PI
C/gofree.git
```
# Create shared network
```sh
docker network create gofreeNetwork
```
# RUN MYSQL DOCKER:
```sh
cd /root/laraDocker/sql/ && ./updateGoFDB.sh
```
# Install composer to gofree
```sh
/root/laraDocker/gofreeCmpsr/initGofree.sh
```
# RUN PHP MYADMIN DOCKER:
```sh
docker run -d --name phpmyadmin-gof --network gofreeNetwork --link gofsql:db -p
8080:80 phpmyadmin/phpmyadmin
```
# RUN GOFREE DOCKER:
# Build own docker images with php mysql composer etc...
```sh
cd /root/laraDocker/gofreeDckr && ../sh/bldGoF.sh && ../sh/dockToBckgrnd.sh
```
# SELENIUM
# Detached docker, run in background
```sh
docker run -d --name sele --net=gofreeNetwork --net-alias=selenium -e GEOMETRY="
1280x1024x16" -v /dev/shm:/dev/shm -p 5900:5900 selenium/standalone-firefox-debu
g:2.53.0
```
##### Check your < IP ADDR >:80 , you will see gofree login page
##### Check your < IP ADDR >:8080 , you will see gofree phpmyadmin site
##### Check your < IP ADDR >:4444 , you will see selenium hub
##### At your < IP ADDR >:3306 , mysql running
##### SELENIUM vnc connection is available with ssh tunnel (port:5900) ! ex.: ss
h -L 5900:localhost5900 root@euca
##
##
##### TODO
####### => gofree is ready to use
####### docker /var/lib/ link to /ephemeral drive
################## SETUP END ##################
#### JENKINS SLAVE IN EUCA
```sh
apt-get -y update &&\
apt-get -y upgrade &&\
apt-get -y install openjdk-8-jdk &&\
useradd -m jenkins -s /bin/bash &&\
usermod -aG docker jenkins &&\
cp /root/laraDocker/ssh/* /home/jenkins/.ssh &&\
sudo -u jenkins mkdir /home/jenkins/.ssh &&\