Skip to content

Instantly share code, notes, and snippets.

View dasgoll's full-sized avatar

dasgoll

  • Amman, Jordan
View GitHub Profile
wget https://get.docker.io/builds/Linux/x86_64/docker-latest -O docker
cp docker /usr/local/bin/
chmod +x /usr/local/bin/docker
root@ubuntu:~/downloads# docker -d &
[1] 7681
root@ubuntu:~/downloads# 2014/09/15 07:12:55 docker daemon: 1.2.0 fa7b24f; execdriver: native; graphdriver:
[a4987479] +job serveapi(unix:///var/run/docker.sock)
[info] Listening for HTTP on unix (/var/run/docker.sock)
[a4987479] +job init_networkdriver()
docker host1 = Centos
docker host2 = Ubuntu
docker pull busybox:latest
docker run -it --name busygoll -h busygoll busybox:latest /bin/bash
## do your customizations
docker commit 7d784b1e3c78 busygoll:latest
docker save 6c4412b1e31e > busygoll.tar# on docker host1
docker load < busygoll.tar # on docker host2
git clone git://github.com/yyuu/pyenv.git .pyenv
echo 'export PYENV_ROOT=$HOME/.pyenv' >> ~/.bashrc
echo 'export PATH=$PYENV_ROOT/bin:$PATH' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
. ~/.bashrc
pyenv install -v 3.7.0
pyenv global 3.7.0
pyenv rehash
## I needed those last time
yum install gcc zlib-devel openssl-devel mysql-devel
## could be needed (??)
libz-dev (or zlib)
libbz2-dev
libreadline-dev
libsqlite3-dev
libncurses5-dev
[root@centos65vm1 man1]# docker inspect -f '{{ json .NetworkSettings }}' busygoll
{"Bridge":"docker0","Gateway":"172.17.42.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"PortMapping":null,"Ports":{}}
[root@centos65vm1 man1]# docker inspect -f '{{ json .NetworkSettings }}' busygoll | python -mjson.tool
{
"Bridge": "docker0",
"Gateway": "172.17.42.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
That’s one of the real strengths of Docker: the ability to go back to a previous commit. The secret is simply to docker tag the image you want.
Here’s an example. In this example, I first installed ping, then committed, then installed curl, and committed that. Then I rolled back the image to contain only ping:
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
f770fc671f11 12 seconds ago apt-get install -y curl 21.3 MB
28445c70c2b3 39 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
FROM debian:jessie
ENV VERSION 2.25
RUN apt-get update -q
RUN apt-get install -qy curl build-essential
RUN mkdir /src
WORKDIR /src
RUN curl https://www.kernel.org/pub/linux/utils/util-linux/v$VERSION/util-linux-$VERSION.tar.gz \
| tar -zxf-
RUN ln -s util-linux-$VERSION util-linux
WORKDIR /src/util-linux
FROM debian:jessie
ENV VERSION 2.25
RUN apt-get update -q
RUN apt-get install -qy curl build-essential
RUN mkdir /src
WORKDIR /src
RUN curl https://www.kernel.org/pub/linux/utils/util-linux/v$VERSION/util-linux-$VERSION.tar.gz \
| tar -zxf-
RUN ln -s util-linux-$VERSION util-linux
WORKDIR /src/util-linux
root@cdh5-datanode1-host ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3d2d9ee077f index.docker.devops.souq/analytics/ds-cdh5-datanode:v0.0.1 "supervisord -n" 25 minutes ago Up 25 minutes 0.0.0.0:2222->22/tcp cdh5-datanode1-container
chroot /var/lib/docker/devicemapper/mnt/f3d2d9ee077fa23427bbc4300a1bc841476cfd89fa68e060ee517f39e9a67fee/rootfs/
Turn your Emails into Reminders
Evernote is not just a tool for archiving emails but the same workflow can be used to create quick reminders from your mailbox. Compose a new message, or forward an existing one, and put an exclaimation symbol in the subject line followed by the date when you would like to be reminded and send it to your Evernote address. For instance:
Subject: Learn how to code !2014/12/12
Subject: Pick up flowers !tomorrow