SlideShare a Scribd company logo
10
Most read
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/
• 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/bash
root@3fc580098e33:/#
vagrant@precise64:~$ sudo su
root@precise64:/home/vagrant#
• Second we need to update our system packages
from what is included in our base image:
root@3fc580098e33:/# apt-get update
Ign http://archive.ubuntu.com quantal InRelease
Hit http://archive.ubuntu.com quantal Release.gpg
Hit http://archive.ubuntu.com quantal Release
Hit http://archive.ubuntu.com quantal/main amd64 Packages
Get: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... Done
root@3fc580098e33:/#
• 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
• 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
• 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:/# exit
exit
root@precise64:/home/vagrant#
root@precise64:/home/vagrant# docker ps -a
ID IMAGE COMMAND CREATED STATUS
3fc580098e33 base:latest /bin/bash 11 minutes ago Exit 0
• 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/postfix
8fb2aa0b00ec
root@precise64:/home/vagrant# docker run -i -t vcoisne/postfix /bin/bash
root@bb7db5ecd9f0:/#
root@bb7db5ecd9f0:/# postfix start
• 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
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

More Related Content

PDF
How to write a Dockerfile
PDF
Linux commands
PDF
Docker Architecture (v1.3)
PPTX
Docker intro
PDF
Docker 101
PPTX
Docker Networking Overview
PDF
Docker Introduction
PDF
How to write a Dockerfile
Linux commands
Docker Architecture (v1.3)
Docker intro
Docker 101
Docker Networking Overview
Docker Introduction

What's hot (20)

PDF
Docker Basics
PDF
Introduction to Docker - VIT Campus
PPTX
Docker 101 : Introduction to Docker and Containers
PDF
Introduction to docker
PDF
Introduction to Docker
PDF
docker installation and basics
PDF
A Hands-On Introduction To Docker Containers.pdf
PDF
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
PPTX
Docker.pptx
PPTX
Introduction to Docker
PDF
Docker 101: An Introduction
PDF
Introduction to Docker
PPTX
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
PDF
Docker 101: Introduction to Docker
PPTX
Dockers and containers basics
PDF
Docker internals
PPTX
Introduction to docker
PPTX
Introduction to Docker - 2017
PPTX
Docker introduction for the beginners
PPTX
Docker: From Zero to Hero
Docker Basics
Introduction to Docker - VIT Campus
Docker 101 : Introduction to Docker and Containers
Introduction to docker
Introduction to Docker
docker installation and basics
A Hands-On Introduction To Docker Containers.pdf
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
Docker.pptx
Introduction to Docker
Docker 101: An Introduction
Introduction to Docker
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
Docker 101: Introduction to Docker
Dockers and containers basics
Docker internals
Introduction to docker
Introduction to Docker - 2017
Docker introduction for the beginners
Docker: From Zero to Hero
Ad

Similar to Installing and running Postfix within a docker container from the command line (20)

PDF
Docker_AGH_v0.1.3
PDF
Vagrant + Docker provider [+Puppet]
PPTX
Docker and the Container Ecosystem
PDF
Managing Docker containers
PDF
Taking Control of Chaos with Docker and Puppet
PDF
Docker puppetcamp london 2013
PDF
Introduction To Docker
PDF
Introduction to docker
PDF
Talk about Docker
PDF
Docker Demo @ IuK Seminar
PPTX
Introduction to Docker
PDF
Introduction to Docker
PDF
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PDF
Challenges of container configuration
ODP
Docker - The Linux Container
PPTX
Getting Started with Docker
PPTX
Docker
PDF
Introduction to docker
PDF
Preparation study of_docker - (MOSG)
PDF
Work shop - an introduction to the docker ecosystem
Docker_AGH_v0.1.3
Vagrant + Docker provider [+Puppet]
Docker and the Container Ecosystem
Managing Docker containers
Taking Control of Chaos with Docker and Puppet
Docker puppetcamp london 2013
Introduction To Docker
Introduction to docker
Talk about Docker
Docker Demo @ IuK Seminar
Introduction to Docker
Introduction to Docker
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
Challenges of container configuration
Docker - The Linux Container
Getting Started with Docker
Docker
Introduction to docker
Preparation study of_docker - (MOSG)
Work shop - an introduction to the docker ecosystem
Ad

More from dotCloud (20)

PPTX
Immutable infrastructure with Docker and EC2
PDF
Docker at Spotify - Dockercon14
PPTX
John Engates Keynote at Dockercon 14
PDF
Building a smarter application Stack by Tomas Doran from Yelp
PPTX
DockerCon Keynote Ben Golub
PDF
Are VM Passé?
PDF
OpenStack - Docker - Rackspace HQ
PDF
Docker in pratice -chenyifei
PDF
Wot2013云计算架构师峰会 -陈轶飞2
PPTX
Docker introduction
PDF
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
PDF
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
PPTX
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
PDF
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
PPTX
Dockerizing stashboard - Docker meetup at Twilio
PPTX
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
PDF
Dockerizing your applications - Docker workshop @Twitter
PDF
Introduction to Docker - Docker workshop @Twitter
PDF
Docker worshop @Twitter - How to use your own private registry
PDF
Docker links | Docker workshop #2 at Twitter
Immutable infrastructure with Docker and EC2
Docker at Spotify - Dockercon14
John Engates Keynote at Dockercon 14
Building a smarter application Stack by Tomas Doran from Yelp
DockerCon Keynote Ben Golub
Are VM Passé?
OpenStack - Docker - Rackspace HQ
Docker in pratice -chenyifei
Wot2013云计算架构师峰会 -陈轶飞2
Docker introduction
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Dockerizing stashboard - Docker meetup at Twilio
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Dockerizing your applications - Docker workshop @Twitter
Introduction to Docker - Docker workshop @Twitter
Docker worshop @Twitter - How to use your own private registry
Docker links | Docker workshop #2 at Twitter

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
20250228 LYD VKU AI Blended-Learning.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Monthly Chronicles - July 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?

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

  • 1. Installing and running Postfix within a docker container from the command line
  • 2. 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/
  • 3. • 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/bash root@3fc580098e33:/# vagrant@precise64:~$ sudo su root@precise64:/home/vagrant#
  • 4. • Second we need to update our system packages from what is included in our base image: root@3fc580098e33:/# apt-get update Ign http://archive.ubuntu.com quantal InRelease Hit http://archive.ubuntu.com quantal Release.gpg Hit http://archive.ubuntu.com quantal Release Hit http://archive.ubuntu.com quantal/main amd64 Packages Get: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... Done root@3fc580098e33:/#
  • 5. • 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
  • 6. • 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
  • 7. • 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:/# exit exit root@precise64:/home/vagrant# root@precise64:/home/vagrant# docker ps -a ID IMAGE COMMAND CREATED STATUS 3fc580098e33 base:latest /bin/bash 11 minutes ago Exit 0
  • 8. • 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/postfix 8fb2aa0b00ec root@precise64:/home/vagrant# docker run -i -t vcoisne/postfix /bin/bash root@bb7db5ecd9f0:/# root@bb7db5ecd9f0:/# postfix start
  • 9. • 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
  • 10. 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