Wednesday, July 23, 2014

how to install docker on AWS EC2 CentOS instance.

<You can still despise git within a year, but not docker.>
sudo yum -y install docker-io
sudo service docker start
sudo chkconfig docker on
test to create an ubuntu container

sudo docker run -it ubuntu sh



<demo>
[ec2-user@ip-172-31-27-45 ~]$ sudo yum -y install docker-io
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                         | 2.1 kB     00:00     
amzn-updates/latest                                      | 2.3 kB     00:00     
mongodb                                                  |  951 B     00:00     
Package docker-1.0.0-1.15.amzn1.x86_64 already installed and latest version
Nothing to do

[ec2-user@ip-172-31-27-45 ~]$ sudo service docker start
Starting cgconfig service:                                 [  OK  ]
Starting docker:                                   [  OK  ]

[ec2-user@ip-172-31-27-45 ~]$ sudo chkconfig docker on

[ec2-user@ip-172-31-27-45 ~]$ sudo docker run -it ubuntu sh
Unable to find image 'ubuntu' locally
Pulling repository ubuntu
ba5877dc9bec: Download complete 
511136ea3c5a: Download complete 
9bad880da3d2: Download complete 
25f11f5fb0cb: Download complete 
ebc34468f71d: Download complete 
2318d26665ef: Download complete 
# uname -a
Linux d5d4e7e0ea4e 3.10.38-49.136.amzn1.x86_64 #1 SMP Mon May 5 18:28:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
# df
Filesystem                                                                                       1K-blocks    Used Available Use% Mounted on
/dev/mapper/docker-202:1-147559-d5d4e7e0ea4e50bff40e7e53a4106e2c238066811bbebbe86020f1c7cce987dd  10190136  228364   9421100   3% /
tmpfs                                                                                               303460       0    303460   0% /dev
shm                                                                                                  65536       0     65536   0% /dev/shm
/dev/xvda1                                                                                         8125880 7426032    599580  93% /etc/hosts
tmpfs                                                                                               303460       0    303460   0% /proc/kcore
# exit
[ec2-user@ip-172-31-27-45 ~]$ uname -a
Linux ip-172-31-27-45 3.10.38-49.136.amzn1.x86_64 #1 SMP Mon May 5 18:28:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[ec2-user@ip-172-31-27-45 ~]$ df
df: ‘/var/lib/docker/devicemapper’: Permission denied
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1       8125880 7426012    599600  93% /
devtmpfs          287060      52    287008   1% /dev
tmpfs             303460       0    303460   0% /dev/shm




No comments:

Post a Comment