installing and running postfix within a docker container from the command line

10
Installing and running Postfix within a docker container from the command line

Upload: dotcloud

Post on 28-Jan-2015

114 views

Category:

Technology


3 download

DESCRIPTION

Installing and running Postfix within a docker container from the command line

TRANSCRIPT

Page 1: Installing and running Postfix within a docker container from the command line

Installing and running Postfix within a docker container from the

command line

Page 2: Installing and running Postfix within a docker container from the command line

Requirements

• In order to complete this tutorial, you should make sure that you have docker installed. For more information about installation please visit the following page: http://docs.docker.io/en/latest/

• In addition to installation, you can start using docker through the interactive tutorial: http://www.docker.io/gettingstarted/

Page 3: Installing and running Postfix within a docker container from the command line

• First we have to make sure we are “root” to have permission to start a container

• so we can start up a new container using the base image with the docker command below

root@precise64:/home/vagrant# docker run -i -t base /bin/bashroot@3fc580098e33:/#

vagrant@precise64:~$ sudo suroot@precise64:/home/vagrant#

Page 4: Installing and running Postfix within a docker container from the command line

• Second we need to update our system packages from what is included in our base image:

root@3fc580098e33:/# apt-get updateIgn http://archive.ubuntu.com quantal InReleaseHit http://archive.ubuntu.com quantal Release.gpgHit http://archive.ubuntu.com quantal ReleaseHit http://archive.ubuntu.com quantal/main amd64 PackagesGet:1 http://archive.ubuntu.com quantal/universe amd64 Packages [5274 kB]Get:2 http://archive.ubuntu.com quantal/multiverse amd64 Packages [131 kB]Get:3 http://archive.ubuntu.com quantal/main Translation-en [660 kB]Get:4 http://archive.ubuntu.com quantal/multiverse Translation-en [100 kB]Get:5 http://archive.ubuntu.com quantal/universe Translation-en [3648 kB]Fetched 9813 kB in 35s (277 kB/s)Reading package lists... Doneroot@3fc580098e33:/#

Page 5: Installing and running Postfix within a docker container from the command line

• Then we can move on to postfix installation

• While the program is being installed, the following window will open inside your terminal, just press <OK> to continue

root@3fc580098e33:/# apt-get install -y postfix

Page 6: Installing and running Postfix within a docker container from the command line

• The next windows that will appear ask you to select a general type of mail configuration, select Internet Site and press enter For the system mail name one, just press <OK> to continue

Page 7: Installing and running Postfix within a docker container from the command line

• Once the installation is completed, we can go back to our host to commit the newly created image.

• To get the ID of the image we can either copy it from after the root in red here above or use the following Docker command and select the first ID of the list

root@5adc2f590393:/# exitexitroot@precise64:/home/vagrant#

root@precise64:/home/vagrant# docker ps -aID IMAGE COMMAND CREATED STATUS 3fc580098e33 base:latest /bin/bash 11 minutes ago Exit 0

Page 8: Installing and running Postfix within a docker container from the command line

• Now that we have the ID we are ready to commit

• Lets check that Postfix is installed on this image. We spawn a new container from this image and run bash inside.

• Now that we are inside the container, we can check that postfix is installed

root@precise64:/home/vagrant# docker commit 3fc580098e33 vcoisne/postfix8fb2aa0b00ec

root@precise64:/home/vagrant# docker run -i -t vcoisne/postfix /bin/bashroot@bb7db5ecd9f0:/#

root@bb7db5ecd9f0:/# postfix start

Page 9: Installing and running Postfix within a docker container from the command line

• OK, It looks like postfix is running inside our Docker container ! It is now time to share our work with the docker community. To do so we can push that image on the docker index to store the filesystem state and make it available for re-use.

• In order to push your image on the docker index, you first have to sign up: https://index.docker.io/account/signup/

• Then just replace vcoisne by your username to push your images to your own repository

root@precise64:/home/vagrant# docker push vcoisne/postfix

Page 10: Installing and running Postfix within a docker container from the command line

Want to learn more ?

• Sign up for Docker Weekly on www.docker.io• https://twitter.com/docker/• https://github.com/dotcloud/docker• http://stackoverflow.com/search?q=docker• https://botbot.me/freenode/docker/#• https://groups.google.com/forum/#!forum/do

cker-user