Monday, March 21, 2016

docker survival kit

on Ubuntu 14.04:

-------------- docker service itself
service docker start

-------------- install
sudo bash
vi /etc/apt/sources.list.d/docker.list
deb https://apt.dockerproject.org/repo ubuntu-trusty main

apt-get update
you may have to do this with the associated keys if the former doesn't work
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F76221572C52609D

apt-get -y install docker.io
apt-get install docker-engine
(don't do    "apt-get install docker")

ln -sf /usr/bin/docker /usr/local/bin/docker
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
or
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker
(depends which works)
  • start docker daemon
    • $ sudo service docker start
docker -v    (should be at least 1.12)
docker version
docker info
docker pull hello-world
docker run -i -t  hello-world

docker pull centos:6.6
docker run -i -t centos:6.6 /bin/bash

sudo docker images -a


------------- Main
  • Run but exits right away with an error. Still, creates a container.
    • docker run ubuntu
  • Run and keeps an interactive session
    • docker run -it ubuntu /bin/bash
    • docker run -it alpine /bin/sh
    • sudo docker run -i -t {repository_name}:{tag} /bin/bash
  • Execute in a running container:
    • “docker exec -i -t 7b33f4ed03a7 /bin/bash”
    • sudo docker exec -i -t $(sudo docker ps -l -q) env
  • Restart an existing container to continue working in it
    • docker start 912ccdad8380
    • then docker exec -it 912ccdad8380 /bin/bash

  • To build a container from a Dockerfile:
    • sudo docker build {Dockerfile_path}
------------- 
docker rename 7d8b244480a2 my_django____4         (rename a container)
docker commit 7d8b244480a2  bob/hello_django:version2  (commit a new image from a running container)

docker save -o /home/bob/bob-hello-django-version4.tar  bob/hello_django:version2

docker load -i bob-hello-django-version2.tar

-------------
- "ls /etc/*release"  to know the container OS.
- remove all containers and clear cache (do not remove images...):
-- docker rm $(docker ps -a -q) && docker ps -a | cut -c-12 | xargs docker rm
  • remove a specific image 
    • sudo docker rmi -f 4f8eceb5cb78
  • ignore container entrypoint:
    • docker run -it --entrypoint=/bin/bash michal/hello_django_srp:version5
------------- problem 1
Docker version 1.6.2, build 7c8fca2

> docker save -o /tmp/docker1.tar  michal/hello_django_srp:version6

FATA[0000] Error response from daemon: could not find image: no such id:  michal/hello_django_srp:version6 
--> there are two spaces before "michal" and docker is not robust to this
------------- static IP address
docker network create --subnet=172.18.0.0/16 mynet18 docker run --net mynet18 --ip 172.18.0.22 -it ubuntu:14.04 bash
------------- bind volume mount (you need data from the host machine)
docker run -it -v /home/lee/tmp/docker-bind:/opt/container-path bob/solr_6_6:v7

otherwise, you can simply copy from the host to the container:
docker cp ./syn_acc.txt dfccf5a493c3:/usr/share/elasticsearch/config/resources/v1_02/
------------- other commands
docker inspect 7832d56ddf56
docker run -it -p 8580:8080 bob/my-jetty:v1 (port matching)
.
.

Sunday, March 20, 2016

strange colors on vlc / Windows 7 / need nvidia driver



http://fr.download.nvidia.com/Windows/341.92/341.92-notebook-win8-win7-64bit-international.exe


Tuesday, March 15, 2016

Debugging Tomcat remotely using JMX


Start the tomcat as follows
./start.sh -d -p 8001 -j -m 9001 -h 10.2.14.2

From Eclipse:
  - debug configurations
  - "Remote Java application"
  - "connect" tab
    . Host running the tomcat
    . Port: 8001