Wednesday, March 12, 2014

install Docker on Ubuntu 13.10

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D8576A8BA88D21E9
$ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker

$ sudo docker version
Client version: 0.9.0
Go version (client): go1.2.1
Git commit (client): 2b3fdf2
Server version: 0.9.0
Git commit (server): 2b3fdf2
Go version (server): go1.2.1
Last stable version: 0.9.0

$ sudo docker search ubuntu | grep '^ubuntu'
ubuntu      General use Ubuntu base image. Tags availa...   108
ubuntu-upstart                                              0
ubuntu/ping                                                 0

$ sudo docker pull ubuntu:saucy
Pulling repository ubuntu
9f676bd305a4: Download complete
511136ea3c5a: Download complete
1c7f181e78b9: Download complete

$ sudo docker images -a
REPOSITORY                TAG     IMAGE ID      CREATED        VIRTUAL SIZE
ubuntu                    saucy   9f676bd305a4  5 weeks ago    178 MB
<none>                    <none>  1c7f181e78b9  5 weeks ago    0 B
<none>                    <none>  511136ea3c5a  9 months ago   0 B

$ sudo docker run -i -t -privileged=true ubuntu:saucy /bin/bash

# apt-get install openjdk-7-jdk


# exit

$ sudo docker ps -a
CONTAINER ID  IMAGE                           COMMAND    CREATED      STATUS   PORTS  NAMES
6a3720326142  ubuntu:saucy                    /bin/bash  2 hours ago  Exit 0          stupefied_bell

$ sudo docker commit 6a3720326142 jerry/ubuntu13.10_java7
5d7e72d6b3a571f384efdbe31418f47b7d32eb6e5df9fe5c7c5357dc07843f86

$ sudo docker images -a
REPOSITORY                TAG     IMAGE ID      CREATED        VIRTUAL SIZE
jerry/ubuntu13.10_java7   latest  5d7e72d6b3a5  3 minutes ago  512.5 MB
ubuntu                    saucy   9f676bd305a4  5 weeks ago    178 MB
<none>                    <none>  1c7f181e78b9  5 weeks ago    0 B
<none>                    <none>  511136ea3c5a  9 months ago   0 B

$ sudo docker rmi IMAGE_ID

$ sudo docker ps -a
CONTAINER ID  IMAGE                           COMMAND    CREATED      STATUS   PORTS  NAMES
2aec90f4a9c3  jerry/ubuntu13.10_java7:latest  /bin/bash  2 hours ago  Exit -1         nostalgic_pike
6a3720326142  ubuntu:saucy                    /bin/bash  2 hours ago  Exit 0          stupefied_bell

$ sudo docker rm CONTAINER_ID

$ sudo docker run jerry/ubuntu13.10_java7 java -version
WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers can't use it. Using default external servers : [8.8.8.8 8.8.4.4]
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

$ sudo docker start 2aec90f4a9c3

$ sudo docker attach 2aec90f4a9c3
ifconfig
eth0      Link encap:Ethernet  HWaddr 0e:5a:8f:4b:46:a3  
          inet addr:172.17.0.2  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::c5a:8fff:fe4b:46a3/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1687 (1.6 KB)  TX bytes:1014 (1.0 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

$ sudo docker stop 2aec90f4a9c3

No comments:

Post a Comment