Docker Stuff

Processes, scripts, install records and general info about " Docker Stuff "

Moving Images to Another Partition  |   Pull a Docker Container  |   Enter a Docker Container  |   Open and keep open a Docker Container  |   Installing Anaconda in a Container  |   Problem starting Docker   |   Start a Server  |   List and Delete Dangling Images  |   Open an Image With prompt  |   Installing MathJax in A Container  |   Remove All Exited Containers  |   Portainer info  |   Stop and Remove All Containers  |   Copy to and From Containers  |   ipython/notebook  |   deep-dream-generator  |  

Set up password in jupyter_notebook_config.py

RUN jupyter notebook --generate-config
RUN echo "c.NotebookApp.password='sha1:***'">>/root/.jupyter/jupyter_notebook_config.py

Sept 29, 2018 Docker Images and Commands

	
docker run -d -p 80:8888 -e "PASSWORD=MakeAPassword" -e "USE_HTTP=1" ipython/notebook

This makes a playground for python2 and three. Everything is kept inside
so it is isolated from your local machine you may reload container if
you wish anything to persist.
sudo docker run -d -p 80:8888 -e 'PASSWORD=MakeAPassword' -e 'USE_HTTP=1' ipython/notebook
it is not secure."

docker run -d -p 443:8888 -e "PASSWORD=password" -v "$(pwd)"/deep-dream-generator:/src ryankennedyio/deepdream

Deep dream generator


@jack-desktop:~$ docker inspect 1532fdd55c09 | grep "IPAddress"
            "IPAddress": "172.17.0.2",
            "IPAddress": "172.17.0.2",
@jack-desktop:~$ docker inspect 1532fdd55c09 | grep "Pid"
            "Pid": 14301,



--------------------- start-notebook.sh ----------------------------
#!/bin/bash

# Strict mode
set -euo pipefail
IFS=$'\n\t' 
$PEM_FILE="../key.pem"
# Create a self signed certificate for the user if one doesn't exist
if [ ! -f $PEM_FILE ]; then
  openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $PEM_FILE -out $P$
    -subj "/C=XX/ST=XX/L=XX/O=dockergenerated/CN=dockergenerated"
fi

# Create the hash to pass to the IPython notebook, but don't export it so it do$
# as an environment variable within IPython kernels themselves
HASH=$(python3 -c "from IPython.lib import passwd; print(passwd('${PASSWORD}'))$
unset PASSWORD

CERTFILE_OPTION="--certfile=$PEM_FILE"
-----------------------------------------------------------------------------	
http://172.17.0.2:8888/notebooks/?token=da87d2689d99139fd475d9f6bdc3b608d472a99256606bb4




Stop and Remove All Containers

#!/bin/bash

docker stop $(sudo docker ps -aq)
docker rm $(sudo docker ps -aq)

Start command for Ipython Notebook Container

 docker run -d -p 8888:8888 -v /home/jack/Desktop/Ubuntu16.04/notebooks:/notebooks jacknorthrup/darkroom 

Portainer - GUI to manage Docker images and containers

DOCUMENTATION it is also installed as a binarie /opt/portainer/portainer
Portainer install info  |   docker run -d -p 8888:8888 -v $(pwd)/notebooks:/notebooks jacknorthrup/cv-r-caffe:latest jupyter notebook --allow-root --no-browser --ip=0.0.0.0 --port=8888 Save to tar
To save the docker image as a tar file:
docker save -o name.tar NAME/IMAGE/tag
Example:
docker save -o udacity-assignments.tar gcr.io/tensorflow/udacity-assignments:1.0.0

docker run -d -P --hook-ups -v /home/jack/Desktop/Ubuntu16.04/notebooks /notebooks gcr.io/tensorflow/udacity-assignments:1.0.0





docker run -d -P --name web -v /webapp training/webapp python app.py

One liner to stop / remove all of Docker containers:

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)





docker save -o  

Then copy your image to a new system with regular file transfer tools such as cp or scp. After that you will have to load the image into docker:

docker load -i 

PS: You may need to sudo all commands.

docker pull continuumio/anaconda3
dock pull jupyter/datascience-notebook:latest
latest: Pulling from 1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5 jupyter/datascience-notebook:latest dock run -it ufoym/deepo:all-py27-jupyter-cpu

https://hub.docker.com/r/welkineins/ubuntu-xfce-vnc-desktop/ dock pull welkineins/ubuntu-xfce-vnc-desktop docker run -i -t -p 5900:5900 welkineins/ubuntu-xfce-vnc-desktop VIEWER: /home/jack/viewer/viewer.sh Use vnc viewer to :5900 ------------------------ https://takp.me/posts/great-image-completion-siggraph-paper/ --------------------------- docker pull eclipse/ubuntu_python https://takacsmark.com/dockerfile-tutorial-by-example-dockerfile-best-practices-2018/ ~/Desktop/mydockfile$ dock build -t jacknorthrup/eclipse-ubuntu:ver01.0 . dock pull gcc

Good Funtioning Docker Images


dorowu/ubuntu-desktop-lxde-vnc

docker run -it --rm -p 6080:80 dorowu/ubuntu-desktop-lxde-vnc
/home/jack/git/docker-ubuntu-vnc-desktop/

Store and Read Ipython-Notebooks dl-docker

/home/jack/git/dl-docker/

To find where a Notebook is

docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fb46109b1648
172.17.0.2

notebook says --
0000:8888/login?next=%2Ftree%3Ftoken%3Db96be179c581876e6aa9549cb1125f202eece6da8ab3484e%3A8888%2F%3F
so 172.17.0.2:8888/login?next=%2Ftree%3Ftoken%3Db96be179c581876e6aa9549cb1125f202eece6da8ab3484e%3A8888%2F%3F
Emergency start:
ps axf | grep docker | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh

Creating a container from a Dockerfile


docker build -t docker-machine .

In this case 'docker-machine' is the name I chose to name my container. The period at the end of the command is important.
will show if Docker is running behind the scenes

sudo journalctl -u docker Will stop docker:
ps axf | grep docker | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh

List all open containers

docker ps
docker ps -a        -- will list all containeres open or exited
sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm

Will delete all containers that have been exited

List all open images

docker images

Open a Container and do Nothing

docker run -d firefox/mine tail -f /dev/null
the ' tail -f /dev/null ' keeps it open
-- enter a container docker exec -it 9c872d43ba62 bash must be running else you will get message similar to: Error response from daemon: Container e5777562c7a1a5301a1d486b8559bd6098d51142d198964162787f288db4395e is not running --- Also WORKED: docker run -t -i 5e373d931ec8 bash export PYTHONPATH=/opt/usecaffe/python/caffe:$PYTHONPATH export CAFFE_ROOT=/opt/usecaffe/python/caffe List stopped containers: docker ps -f "status=exited" just backed up jacknorthrup_deepdream it will create a tar in the directory you are in: docker save jacknorthrup/deepdream > jacknorthrupdeepdream.tar docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH docker cp 3f53165cdcf1:/home/jack/git/clouddream/googlenet_places205 /opt/caffe/|- docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH sudo docker cp 3f53165cdcf1:/home/jack/git/clouddream/googlenet_places205/* /opt/caffe/models/googlene_places205 docker tag 7d9495d03763 maryatdocker/docker-whale:latest docker tag 0d23962c9cb6 jacknorthrup/deepdream:latest docker push jacknorthrup/deepdream inception_3a: mostly geometric patterns inception_3b: still just patterns inception_4a: eyes and some dogs inception_4b: lots of dog faces inception_4c: starting to get more into cars and buildings inception_4d: more of a menagerie inception_4e: lots of different animals; birds, snakes, monkeys, and so on enter a snapshot : docker run -t -i mysnapshot /bin/bash

adding MathJax.js to a Container


Running the following command will download and install MathJax in you Docker container.

python -c 'from IPython.external import mathjax; mathjax.install_mathjax("2.5.1")'
    RESPONSE:

    < -c 'from IPython.external import mathjax; mathjax.install_mathjax("2.5.1")'
Downloading mathjax source from https://github.com/mathjax/MathJax/archive/2.5.1.tar.gz
Extracting to /root/.ipython/nbextensions/mathjax
root@e7409d05b374:/# 


Installing Anaconda in a docker container


curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
The container did not have curl so :
root@2bd20662c982:/home# curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
bash: curl: command not found
root@2bd20662c982:/home# apt-get install curl
	
Now curl is installed .	

 curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
 ( the file is large 462M)
 The response will be something like this:
root@2bd20662c982:/home# curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
  %   Total   % Received   %  Xferd  Average  Speed      Time          Time     Time            Current
                                                            Dload   Upload    Total          Spent    Left                Speed
   3  462M   3        16.M     0        0        148k            0    0:02:20      0:16:24  0:26:24           250k   

Once the download is completed enter:
bash Anaconda2-4.3.1-Linux-x86_64.sh

Installing Caffe in a Docker Container

List Remove dangling/Unattached Docker images

List all dangling images:
docker images -a -f dangling=true

Remove all dangling images:
docker rmi $(docker images -aq -f dangling=true)

To open an image with a prompt to


docker run -t -i --rm --name inspect-inside dataquestio/python3-starter /bin/bash


Problem starting Docker After Power outage

jack@jack-desktop:~$ sudo dockerd
INFO[0000] libcontainerd: previous instance of containerd still alive (3064) 
INFO[0000] [graphdriver] using prior storage driver "aufs" 
ERRO[0002] Error during layer Store.Cleanup(): device or resource busy 
FATA[0002] Error starting daemon: timeout               
jack@jack-desktop:~$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
jack@jack-desktop:~$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
jack@jack-desktop:~$ sudo rm /var/run/docker.pid

jack@jack-desktop:~$ service docker restart

ALL IS WELL NOW (with Docker ) but there is more when running DeepDream!

Reset DeepDream

	jack@jack-desktop:~/git/clouddream$ ./start.sh
docker: Error response from daemon: Conflict. The name "/deepdream-files" is already in use by container 65701344e22850641838f558c2105675f5f373fe80826654a80ae4fe6f4aaa56. You have to remove (or rename) that container to be able to reuse that name..
See 'docker run --help'.
docker: Error response from daemon: Conflict. The name "/deepdream-compute" is already in use by container 7beda55a5fb2c62bbd6d70c120f68014283ad44c1c5f0c62908976bdd49bc77a. You have to remove (or rename) that container to be able to reuse that name..
See 'docker run --help'.
docker: Error response from daemon: Conflict. The name "/deepdream-json" is already in use by container b4b321bc28749603d88f7fc6fc96246507547d1ba083644142d2d0daab4cb55c. You have to remove (or rename) that container to be able to reuse that name..
See 'docker run --help'.
jack@jack-desktop:~/git/clouddream$ docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS                           PORTS               NAMES
c02237e1e88a        weaveworks/plugin:1.5.2                 "/home/weave/plugin"     6 months ago        Up 5 minutes                                         weaveplugin
fc392924ec17        weaveworks/weave:1.5.2                  "/home/weave/weaver -"   6 months ago        Up 5 minutes                                         weave
6b218a317c80        dockercloud/network-daemon:1.11.1-cs1   "/run.sh"                6 months ago        Restarting (127) 2 minutes ago                       weave-17102.dd7540fd
jack@jack-desktop:~/git/clouddream$ ./stop.sh
deepdream-files
deepdream-compute
deepdream-json
Error response from daemon: No such container: deepdream-enter
deepdream-files
deepdream-compute
deepdream-json
Error response from daemon: No such container: deepdream-enter
jack@jack-desktop:~/git/clouddream$ ./start.sh
2bca629c715ff521fa58269892a5a5735de50028dfd6c90e62fef659d616227b
e5777562c7a1a5301a1d486b8559bd6098d51142d198964162787f288db4395e
d6a9cad9bfd38c1ada40273d50ed3d75a34eb0dd77fc45220fd31c0fb9660c54
 
 resolved !

Bash Stuff


BASH STUFF

locate all of an extension and copy to a directory

find . -type f -name "*.ipynb" -exec cp {} /home/jack/python3-starter/misc/ \;

Using a Dockerfile

From the same directory as the Dockfile, run:

docker build -t jack_linux .  : :< the period at the end is important

Pulling a Docker Container


docker pull container/name
docker run -it -v /path/to/.m2:/root/.m2 ubuntu:latest /bin/bash
will run the ubuntu:latest image with the host directory /path/to/.m2 'symlinked' to the container directory /root/.m2.
docker run -it -v /home/jack/machine:/root docker-machine /bin/bas
sudo docker cp a532acddf9f2://go/src/github.com/docker/machine /home/jack/machine

dock pull 1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5
Using default tag: latest
latest: Pulling from 1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5
3b37166ec614: Pull complete 
504facff238f: Pull complete 
ebbcacd28e10: Pull complete 
c7fb3351ecad: Pull complete 
2e3debadcbf7: Pull complete 
7e5348d3a20b: Pull complete 
d3254a551b86: Pull complete 
3643acaa30cb: Pull complete 
695c56a87048: Pull complete 
bc08b15246bb: Pull complete 
92a983cae4a6: Pull complete 
54693952be7b: Pull complete 
b914ef80ecff: Pull complete 
5a101ee81123: Pull complete 
88d79eaa84d5: Pull complete 
Digest: sha256:563a477780d5f748f23beaacb05f2b1d633c186607ae07b43a796a608b0ff2eb
Status: Downloaded newer image for 1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5:latest
-------------------------------------------------
~/Desktop/Ubuntu16.04$ dock volume create my-vol
my-vol
(base) jack@jack-desktop:~/Desktop/Ubuntu16.04$ dock volume ls
DRIVER              VOLUME NAME
local               154cf0ab76abee6a27101ec3a5e24286ca99474c9943cdd4c6038d5e659ef10f
local               29ecaf5841549a0b1b568e22efb3825cbb5cd078f49a645bda6a083377e11090
local               2fdaaa1a9a8adda501074ec6c9b37ad2cc573b5751c4ee2f19ac6d59c7f674ea
local               3d70ee926055bf6f71474d0dd6338438bb32f694d2b2c73fdc040169eb6ed533
local               45214f318f3c575b9a980996771e3aa39bf1bf7da1f6b119762c2aaf7f161987
local               4aeb602d50c8859f8b57033badee6e59acb50320c8c6b4142f91af538f68819c
local               5c7d235c53f862fc0493df50d9c428ca0051ab37b8bc0a2490912e0fc5561144
local               759cce41a58167d1e053989f35d2b1a48fc454fe94fa183371defaf6f0c80aa7
local               7d84990d4ec232891fb6328450f9292aa225c4ac1a9c75754521a1285c519e23
local               JupyterNotebook-ijs
local               b6d959eb9f8111cc794eb4ba5a8954aaea385085436ca6dcaa4361734309a087
local               c03c3b9fa2e6b83c94e3f6a87b0bf755a3043eb3c3d4be521139d5c2f4b78c18
local               my-vol
(base) jack@jack-desktop:~/Desktop/Ubuntu16.04$ docker volume inspect my-vol
[]
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/volumes/my-vol: dial unix /var/run/docker.sock: connect: permission denied
(base) jack@jack-desktop:~/Desktop/Ubuntu16.04$ dock volume inspect my-vol
[
    {
        "CreatedAt": "2018-09-29T15:57:31+08:00",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/my-vol/_data",
        "Name": "my-vol",
        "Options": {},
        "Scope": "local"
    }
]
-------------------------------------------------
 dock pull gcc
Using default tag: latest
latest: Pulling from library/gcc
05d1a5232b46: Pull complete 
5cee356eda6b: Pull complete 
89d3385f0fd3: Pull complete 
80ae6b477848: Pull complete 
28bdf9e584cc: Pull complete 
bc03bc217902: Pull complete 
e4428a530975: Pull complete 
65dfc81bab8b: Pull complete 
e60697f97b71: Pull complete 
Digest: sha256:2add94835cdba9042b7d19651b4a27f061db4dd0c3648bbda2ed8d1671905b93
Status: Downloaded newer image for gcc:latest

-------------------------------------------------
:~/Desktop/Ubuntu16.04$ dock pull jupyter/datascience-notebook
Using default tag: latest
latest: Pulling from jupyter/datascience-notebook
a48c500ed24e: Pull complete 
1e1de00ff7e1: Pull complete 
0330ca45a200: Pull complete 
471db38bcfbf: Pull complete 
0b4aba487617: Pull complete 
d44ea0cd796c: Pull complete 
5ac827d588be: Pull complete 
d8d7747a335e: Pull complete 
08790511e3e9: Pull complete 
e3c68aea9a5f: Pull complete 
484c6d5fc38a: Pull complete 
0448c1360cb9: Pull complete 
61d7e6dc705d: Pull complete 
92f1091ed72b: Pull complete 
8045d3663a7e: Pull complete 
1bde7ba25439: Pull complete 
59f00570bfaa: Pull complete 
00427dae5b50: Pull complete 
8ed0d7c961ef: Pull complete 
a653dc992384: Pull complete 
3f4dcd3f1344: Pull complete 
bf1d2894347b: Pull complete 
7e0162586bb5: Pull complete 
dc3013275c68: Pull complete 
86d2db62d880: Pull complete 
0bc5af32f7ac: Pull complete 
8b50832cc2fe: Pull complete 
ff9e259b57b7: Pull complete 
7520f861bb7b: Pull complete 
Digest: sha256:e0a1331bddd0a208dc8a28aeb29c1bc947bab0ef66dbc769993de799f8e97f3b
Status: Downloaded newer image for jupyter/datascience-notebook:latest

-------------------------------------------------
dock run --rm -v /foo -v awesome:/bar busybox ls
--
> dock volume create my-vol
> dock volume ls
> dock volume inspect my-vol
> to remove:
> docker volume rm my-vol
> docker run -d --name devtest -v myvol2:/app nginx:latest
> docker inspect devtest
dock run --rm -v /foo -v awesome:/bar busybox top

-------------------------------------------------
:~/Desktop/Ubuntu16.04$ dock run -it ufoym/deepo:all-py27-jupyter-cpu
Unable to find image 'ufoym/deepo:all-py27-jupyter-cpu' locally
all-py27-jupyter-cpu: Pulling from ufoym/deepo
297061f60c36: Pull complete 
e9ccef17b516: Pull complete 
dbc33716854d: Pull complete 
8fe36b178d25: Pull complete 
686596545a94: Pull complete 
b2a8d7bb8c8f: Pull complete 
Digest: sha256:68b9eaa30074a30787444aeb3b2f97b640a795707869ea4acf274751ab035849
Status: Downloaded newer image for ufoym/deepo:all-py27-jupyter-cpu

-------------------------------------------------
 dock run -d --name devtest -v myvol2:/app nginx:latest
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
802b00ed6f79: Pull complete 
c16436dbc224: Pull complete 
683eac851b28: Pull complete 
Digest: sha256:e8ab8d42e0c34c104ac60b43ba60b19af08e19a0e6d50396bdfd4cef0347ba83
Status: Downloaded newer image for nginx:latest
adb8c1def4128d667e1137440ad6214cd3a968bba2a9843bd97bf0bb51eedd96

-------------------------------------------------
dock build -t jacknorthrup/eclipse-ubuntu:ver01.0 .
Sending build context to Docker daemon  13.31kB
Step 1/8 : FROM eclipse/ubuntu_jdk8
latest: Pulling from eclipse/ubuntu_jdk8
b234f539f7a1: Pull complete 
55172d420b43: Pull complete 
5ba5bbeb6b91: Pull complete 
43ae2841ad7a: Pull complete 
f6c9c6de4190: Pull complete 
07881665dcee: Pull complete 
39d49cba8d97: Pull complete 
43a78524f477: Pull complete 
e4ffdd012d6b: Pull complete 
1a405f136b60: Pull complete 
8974d888bfab: Pull complete 
95c9c2cecfe8: Pull complete 
Digest: sha256:99752f0ab6bc83abdf54fd7f7679a782fa3ba97de1682676b6b4199db194a085
Status: Downloaded newer image for eclipse/ubuntu_jdk8:latest
 ---> d1f9b3b8934e

-------------------------------------------------
~/Desktop/Ubuntu16.04$ dock pull eboraas/openai-gym
Using default tag: latest
latest: Pulling from eboraas/openai-gym
0f67b3097a06: Pull complete 
5eca1867e6c8: Pull complete 
115dd656f3d1: Pull complete 
501d22732cef: Pull complete 
ca5715696a55: Pull complete 
f017b202c596: Pull complete 
3ba8c96b18b1: Pull complete 
2e512f1b48d3: Pull complete 
f39218de6b43: Pull complete 
c36a0e1299a9: Pull complete 
8b4cb66b010d: Pull complete 
Digest: sha256:17004926a13e2a838d75a4ff597ecad958e1b7d16bef76a1c8aa5f2ce6157aac
Status: Downloaded newer image for eboraas/openai-gym:latest

-------------------------------------------------
docker pull mbartoli/char-rnn
https://hub.docker.com/r/mbartoli/char-rnn/
https://github.com/mbartoli/docker-char-rnn


-------------------------------------------------
Desktop/Ubuntu16.04$ docker pull takp/torch-opencv:latestlatest: Pulling from takp/torch-opencv
4176fe04cefe: Pull complete 
851356ecf618: Pull complete 
6115379c7b49: Pull complete 
aaf7d781d601: Pull complete 
40cf661a3cc4: Pull complete 
975fe2fd635f: Pull complete 
bf4db784e7fd: Pull complete 
0491f7e9426b: Pull complete 
36d30e909625: Pull complete 
c96f2d488db7: Pull complete 
b80f145a5901: Pull complete 
63603797d754: Pull complete 
bac1602c481d: Pull complete 
Digest: sha256:1221a8275bd01e78cc643594dc53841926787a93dc0d5940cd841f42043e6552
Status: Downloaded newer image for takp/torch-opencv:latest

-------------------------------------------------
dock pull jurjean/visual-studio-code 
Using default tag: latest
latest: Pulling from jurjean/visual-studio-code
b3e1c725a85f: Pull complete 
4daad8bdde31: Pull complete 
63fe8c0068a8: Pull complete 
4a70713c436f: Pull complete 
bd842a2105a8: Pull complete 
60f8f81db506: Pull complete 
Digest: sha256:60f98b78e97ec30fb571449a749cbe343e05a3fd6e1f5348ac558fdf735d71de
Status: Downloaded newer image for jurjean/visual-studio-code:latest

--------------------------------------------------

https://github.com/nodejs/docker-node

	docker run -it `# Running interactively, but can be replaced with -d for daemons` \
  -e DISPLAY `# Pass $DISPLAY` \
  -v=/tmp/.X11-unix:/tmp/.X11-unix `# Pass X11 socket` \
  --ipc=host `# Allows MIT-SHM` \
  dockerimage
-------------------------------------------------

NODE DOCKER

http://youknowfordevs.com/2018/07/01/dont-install-node-until-youve-read-this.html

First, create a new directory for your project: mkdir new-project && cd new-project and then launch the latest version of Node: docker run -it --rm node:10.5.0-alpine

dock run -it --rm -v NODE:/usr/src/app -p 127.0.0.1:3000:3000 node:10.5.0-alpine /bin/sh
Unable to find image 'node:10.5.0-alpine' locally
10.5.0-alpine: Pulling from library/node
ff3a5c916c92: Pull complete 
94f111771efe: Pull complete 
87fbae1a7501: Pull complete 
Digest: sha256:628d6994c7b950fda874dbb3bd04be6e5323c311c5c5e485aebe583c3e25b56f
Status: Downloaded newer image for node:10.5.0-alpine

If you haven’t run this version of Node before, Docker will download it for you. After a bit of toing and froing you’ll be left with the usual Node command prompt. Type something like 5+6 and press return to check all is well, and then press [CTRL]+D to exit.

ubuntu-16-nginx-php-phpmyadmin-mysql-5

MySQL 5 with phpMyAdmin on Ubuntu 16.04 LTS (Xenial Xerus)
This image provides a common MySQL database server. The intent is for the data itself to be stored in persistent storage wihch is then
mounted in to this image at /var/lib/mysql

ubuntu-16-nginx-php-phpmyadmin-mysql-5

DOCKER - NON ROOT

https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user
DOCKER NON ROOT

Enter docker-machine

docker exec -it 380753ae8fe5 bash

Docker - docker-machine container build

jack@jack-desktop:~/machine$ docker build -t docker-machine .
Sending build context to Docker daemon 29.82 MB
Step 1 : FROM golang:1.7.4
1.7.4: Pulling from library/golang
5040bd298390: Already exists 
fce5728aad85: Pull complete 
76610ec20bf5: Pull complete 
86b681f75ff6: Pull complete 
8553b52886d8: Pull complete 
63c25ee63bd6: Pull complete 
4268eec6f44b: Pull complete 
Digest: sha256:0b3787ac21ffb4edbd6710e0e60f991d5ded8d8a4f558209ef5987f73db4211a
Status: Downloaded newer image for golang:1.7.4
 ---> f3bdc5e851ce
Step 2 : RUN go get  github.com/golang/lint/golint             github.com/mattn/goveralls             golang.org/x/tools/cover
 ---> Running in 8e4caf1a1c3f
 ---> 04c9c5acc1a0
Removing intermediate container 8e4caf1a1c3f
Step 3 : ENV USER root
 ---> Running in 32f4c2212423
 ---> b92c4312eb1d
Removing intermediate container 32f4c2212423
Step 4 : WORKDIR /go/src/github.com/docker/machine
 ---> Running in 8d8455800f10
 ---> 3ea3a48d2dc1
Removing intermediate container 8d8455800f10
Step 5 : COPY . ./
 ---> 4af2be0c7903
Removing intermediate container cf08dce5d8b5
Step 6 : RUN mkdir bin
 ---> Running in 4af3b9c68631
 ---> 380753ae8fe5
Removing intermediate container 4af3b9c68631
Successfully built 380753ae8fe5

docker restart exec -it 380753ae8fe5 bash

~/Desktop/mydockfile/docker-nodejs-hello-world$ dock build -t jacknorthrup/node-hello .

Sending build context to Docker daemon  71.68kB
Step 1/2 : FROM heroku/nodejs
latest: Pulling from heroku/nodejs
c02c7df4a131: Pull complete 
a3ed95caeb02: Pull complete 
b16a7286d2a5: Pull complete 
011351573868: Pull complete 
2b1dfd98a0af: Pull complete 
77ff860a55bb: Pull complete 
31033e4d7f04: Pull complete 
4fe99c7f1749: Pull complete 
Digest: sha256:4b0885499ca8f74716937362e8c3445c3ad5ce9fdb566dd5ba1510db29c82f98
Status: Downloaded newer image for heroku/nodejs:latest
# Executing 3 build triggers
 ---> Running in b2cd162d7aff
npm WARN package.json node-js-sample@0.2.0 No repository field.
npm WARN package.json node-js-sample@0.2.0 No README data
express@4.16.3 node_modules/express
├── escape-html@1.0.3
├── array-flatten@1.1.1
├── setprototypeof@1.1.0
├── utils-merge@1.0.1
├── cookie-signature@1.0.6
├── merge-descriptors@1.0.1
├── methods@1.1.2
├── path-to-regexp@0.1.7
├── range-parser@1.2.0
├── encodeurl@1.0.2
├── vary@1.1.2
├── parseurl@1.3.2
├── fresh@0.5.2
├── content-type@1.0.4
├── etag@1.8.1
├── statuses@1.4.0
├── cookie@0.3.1
├── content-disposition@0.5.2
├── serve-static@1.13.2
├── safe-buffer@5.1.1
├── depd@1.1.2
├── qs@6.5.1
├── finalhandler@1.1.1 (unpipe@1.0.0)
├── debug@2.6.9 (ms@2.0.0)
├── on-finished@2.3.0 (ee-first@1.1.1)
├── proxy-addr@2.0.4 (forwarded@0.1.2, ipaddr.js@1.8.0)
├── send@0.16.2 (ms@2.0.0, destroy@1.0.4, mime@1.4.1, http-errors@1.6.3)
├── body-parser@1.18.2 (bytes@3.0.0, iconv-lite@0.4.19, http-errors@1.6.3, raw-body@2.3.2)
├── type-is@1.6.16 (media-typer@0.3.0, mime-types@2.1.20)
└── accepts@1.3.5 (negotiator@0.6.1, mime-types@2.1.20)
Removing intermediate container b2cd162d7aff
 ---> 65de7491f984
Step 2/2 : CMD bin/web
 ---> Running in 5e2dcc4dd37b
Removing intermediate container 5e2dcc4dd37b
 ---> e966520f075e
Successfully built e966520f075e
Successfully tagged jacknorthrup/node-hello:latest
docker run -v $HOME/Downloads:/home/firefox/Downloads:rw -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/snd:/dev/snd --privileged -e uid=$(id -u) -e gid=$(id -g) -e DISPLAY=unix$DISPLAY --name firefox firefox-mine



docker run --name firefox-experiment -d firefox/mine:latest /bin/bash -c "cd /root/"" 


	some install script



	dojack@jack-desktop:/dev$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
firefox/mine                  browser             6dda0dc4aa56        25 hours ago        187.9 MB
firefox/mine                  latest              6dda0dc4aa56        25 hours ago        187.9 MB
jack/places                   latest              478d398f90c1        43 hours ago        3.34 GB
docker-machine                latest              380753ae8fe5        3 days ago          742.1 MB
jack_linux                    latest              7b53eef8b065        3 days ago          435.2 MB
mysnapshot                    latest              f070f1f2ec5d        5 days ago          188 MB
nginx                         latest              6b914bbcb89e        10 days ago         181.8 MB
herval/deepdream              latest              5e373d931ec8        12 days ago         1.682 GB
nginx                         < none >              db079554b4d2        3 weeks ago         181.8 MB
ubuntu                        latest              f49eec89601e        7 weeks ago         129.5 MB
jack/ubuntu14.04              latest              b969ab9f929b        7 weeks ago         188 MB
ubuntu                        14.04               b969ab9f929b        7 weeks ago         188 MB
golang                        1.7.4               f3bdc5e851ce        7 weeks ago         673.9 MB
jack_caffepython              latest              c3430efc704a        7 weeks ago         1.614 GB
kaixhin/caffe                 latest              c3430efc704a        7 weeks ago         1.614 GB
hello-world                   latest              c54a2cc56cbb        8 months ago        1.848 kB
dockercloud/network-daemon    1.11.1-cs1          7af149f9041b        8 months ago        35.65 MB
floydhub/dl-docker            cpu                 0b9fc622f1b7        9 months ago        2.873 GB
weaveworks/weavedb            latest              9de1af088a49        9 months ago        244 B
weaveworks/plugin             1.5.2               3cb7adad5437        9 months ago        79.6 MB
weaveworks/weaveexec          1.5.2               4303c7e5118b        9 months ago        68.5 MB
weaveworks/weave              1.5.2               c9735a42a6a2        9 months ago        21.52 MB
ipython/ipython               3.x                 2c1c04a96877        12 months ago       816.7 MB
devurandom/firefox            latest              3ca2edd6733d        12 months ago       746.6 MB
ubuntu                        14.04.3             3876b81b5a81        13 months ago       187.9 MB
dataquestio/python3-starter   latest              3cccab0c85e2        15 months ago       1.796 GB
jacknorthrup/deepdream        latest              a467a05aa177        19 months ago       2.489 GB
visionai/clouddream           latest              a467a05aa177        19 months ago       2.489 GB
ryankennedyio/deepdream       latest              0a9c65d5d2bb        20 months ago       2.878 GB
jack@jack-desktop:/dev$ docker ps


Current Images

REPOSITORY                                             TAG                    IMAGE ID            CREATED             SIZE
jacknorthrup/torch-char                                latest                 386938c1c808        4 hours ago         2.16GB
< none >                                                 < none >                 9dee857de301        7 hours ago         781MB
jacknorthrup/char-rnn-database                         latest                 803f90b18a3d        9 hours ago         1.16GB
jacknorthrup/node-hello                                latest                 e966520f075e        9 hours ago         1.38GB
jacknorthrup/char-rnn                                  latest                 40d096257321        10 hours ago        1.15GB
< none >                                                 < none >                 e8362522b373        16 hours ago        310MB
jacknorthrup/alpine                                    ver01                  05a7cb10a1f7        16 hours ago        48.6MB
< none >                                                 < none >                 5dbb26e7e483        16 hours ago        889MB
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5   latest                 082e92bdee7f        25 hours ago        708MB
nginx                                                  latest                 bc26f1ed35cf        4 days ago          109MB
alpine                                                 3.4                    174b26fe09c7        2 weeks ago         4.82MB
gcc                                                    latest                 1d6ec261d687        3 weeks ago         1.68GB
ubuntu                                                 16.04                  b9e15a5d1e1a        3 weeks ago         115MB
ubuntu                                                 14.04                  c32fae490809        3 weeks ago         188MB
debian                                                 stretch-slim           44e19a16bde1        3 weeks ago         55.3MB
jupyter/datascience-notebook                           latest                 a0da0a3dbd5c        3 weeks ago         6.07GB
busybox                                                latest                 e1ddd7948a1c        2 months ago        1.16MB
eclipse/ubuntu_jdk8                                    latest                 d1f9b3b8934e        2 months ago        749MB
node                                                   10.5.0-alpine          c81046dc8599        3 months ago        69.9MB
ufoym/deepo                                            all-py27-jupyter-cpu   56386798ce35        5 months ago        3.62GB
takp/torch-opencv                                      latest                 76a689514434        5 months ago        4.61GB
kaixhin/torch                                          latest                 bb6780c39bc1        7 months ago        1.14GB
ipython/notebook                                       latest                 c61890b6055e        16 months ago       817MB
jacknorthrup/darkroom                                  latest                 e95a39c80fa3        16 months ago       3.07GB
heroku/nodejs                                          latest                 ab528f5609c3        17 months ago       1.38GB
jurjean/visual-studio-code                             latest                 7bcde672e2da        20 months ago       808MB
eboraas/openai-gym                                     latest                 078191c3c9d0        2 years ago         1.47GB
crisbal/torch-rnn                                      base                   90e6f8c8be88        2 years ago         1.17GB
mbartoli/char-rnn                                      latest                 5b156e888a96        2 years ago         1.36GB
centurylink/dockerfile-from-image                      latest                 970eaf375dfd        2 years ago         19.2MB
ryankennedyio/deepdream                                latest                 0a9c65d5d2bb        3 years ago         2.88GB
welkineins/ubuntu-xfce-vnc-desktop                     latest                 528b0c66a2a1        3 years ago         749MB
nikhilk/ijs                                            latest                 46df1994538a        3 yea


10 docker commands

    docker ps — Lists running containers. Some useful flags include: -a / -all for all containers (default shows just running) and —-quiet /-q to list just their ids (useful for when you want to get all the containers).
    docker pull — Most of your images will be created on top of a base image from the Docker Hub registry. Docker Hub contains many pre-built images that you can pull and try without needing to define and configure your own. To download a particular image, or set of images (i.e., a repository), use docker pull.
    docker build — The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. Use the -t flag to label the image, for example docker build -t my_container . with the . at the end signalling to build using the currently directory.
    docker run — Run a docker container based on an image, you can follow this on with other commands, such as -it bash to then run bash from within the container. Also see Top 10 options for docker run — a quick reference guide for the CLI command. docker run my_image -it bash
    docker logs — Use this command to display the logs of a container, you must specify a container and can use flags, such as --follow to follow the output in the logs of using the program. docker logs --follow my_container
    docker volume ls — This lists the volumes, which are the preferred mechanism for persisting data generated by and used by Docker containers.
    docker rm — Removes one or more containers. docker rm my_container
    docker rmi — Removes one or more images. docker rmi my_image
    docker stop — Stops one or more containers. docker stop my_container stops one container, while docker stop $(docker ps -a -q) stops all running containers. A more direct way is to use docker kill my_container, which does not attempt to shut down the process gracefully first.
    Use them together, for example to clean up all your docker images and containers:

    kill all running containers with docker kill $(docker ps -q)
    delete all stopped containers with docker rm $(docker ps -a -q)
    delete all images with docker rmi $(docker images -q)	

LABEL che:server:8080:ref=tomcat8 che:server:8080:protocol=http che:server:8000:ref=tomcat8-debug che:server:8000:protocol=http
che:server:9876:ref=codeserver che:server:9876:protocol=http
xhost +

Moving docker images location to different partition

First backup of fstab

sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)  

Then stop docker and copy all files per rsync preserving all attributes.

sudo service docker stop  
sudo mkdir /usr/local/docker  
sudo rsync -aXS /var/lib/docker/. /usr/local/docker/
-------- I have done -----------------
sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)
mkdir /mnt/40ec525c-34bc-44ef-99c8-53f5524ad88b/usr/local/docker/ 

sudo rsync -aXS /var/lib/docker/. /mnt/40ec525c-34bc-44ef-99c8-53f5524ad88b/usr/local/docker/

Now it was important to check that everything was copied right. I've did eye check, but diff -r command is useful to. Ok it's important to make new mount and make it durable in fstab. That is what was useful in my case inside of fstab.

# <file> <system> <mount point>   <type>  <options>     <dump>  <pass>
# ...
/usr/local/docker /var/lib/docker none bind 0 0

Now mount of new configuration without reboot.

mount -a  
--------------------------------------------------------

Copy a directory into a docker

ADD go /usr/local/

will copy the contents of your local go directory in the /usr/local/ directory of your docker image.

To copy the go directory itself in /usr/local/ use:

ADD go /usr/local/go

or

COPY go /usr/local/go

Copy files to and from Docker

docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH