SlideShare a Scribd company logo
3
Most read
7
Most read
8
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

PPTX
Installing and running Postfix within a docker container from the command line
PDF
Docker 101
PPTX
Docker.pptx
PPTX
Docker Security workshop slides
PPTX
Docker introduction for the beginners
PPT
Unit Test
PPT
presentation on Docker
PDF
Introduction to docker
Installing and running Postfix within a docker container from the command line
Docker 101
Docker.pptx
Docker Security workshop slides
Docker introduction for the beginners
Unit Test
presentation on Docker
Introduction to docker

What's hot (20)

PDF
Docker Introduction
PDF
Docker 101
PPTX
noSQL
PDF
Automation with ansible
PPTX
Introduction to docker
PDF
Docker Compose by Aanand Prasad
PDF
A Hands-On Introduction To Docker Containers.pdf
PPTX
Docker introduction (1)
PDF
Kubernetes: from zero to be hero
PDF
Introduction to Docker
PDF
Docker Introduction
PDF
spring-api-rest.pdf
PPTX
Automation Testing & TDD
PPTX
Docker 101 - Nov 2016
PPTX
Docker 101 : Introduction to Docker and Containers
PDF
Tp n 6 linux
PDF
Alphorm.com support de la formation Git avancé
PPTX
Creating custom Validators on Reactive Forms using Angular 6
PDF
Docker 101: Introduction to Docker
PDF
formation istqb.pdf
Docker Introduction
Docker 101
noSQL
Automation with ansible
Introduction to docker
Docker Compose by Aanand Prasad
A Hands-On Introduction To Docker Containers.pdf
Docker introduction (1)
Kubernetes: from zero to be hero
Introduction to Docker
Docker Introduction
spring-api-rest.pdf
Automation Testing & TDD
Docker 101 - Nov 2016
Docker 101 : Introduction to Docker and Containers
Tp n 6 linux
Alphorm.com support de la formation Git avancé
Creating custom Validators on Reactive Forms using Angular 6
Docker 101: Introduction to Docker
formation istqb.pdf
Ad

Viewers also liked (20)

PPTX
Dockerizing WordPress
PDF
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
PDF
Building a Platform with Django, Docker and Salt
PPTX
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
PDF
Dockercon Swarm Updated
PPTX
Docker at DevTable
PDF
DockerCon14 Contributing to Docker by Tianon
PDF
Docker at Spotify
PPTX
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
PDF
Contribute and Collaborate 101
PDF
Introduction to Docker and Containers
PDF
Docker Plugin for Heat II
PDF
Authentication and Policy Enforcement for Docker
PDF
A Gentle Introduction to Docker and Containers
PDF
Docker 1.11 @ Docker SF Meetup
PPTX
DockerCon EU 2015: Compute as an Interruption Forget the Servers
PDF
Understanding Containers through Gaming by Brendan Fosberry
PDF
Docker Links
PPTX
DockerCon EU 2015: Sparebank; a journey towards Docker
PDF
DockerCon 2015: Docker Engine Breakout Session
Dockerizing WordPress
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
Building a Platform with Django, Docker and Salt
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Dockercon Swarm Updated
Docker at DevTable
DockerCon14 Contributing to Docker by Tianon
Docker at Spotify
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
Contribute and Collaborate 101
Introduction to Docker and Containers
Docker Plugin for Heat II
Authentication and Policy Enforcement for Docker
A Gentle Introduction to Docker and Containers
Docker 1.11 @ Docker SF Meetup
DockerCon EU 2015: Compute as an Interruption Forget the Servers
Understanding Containers through Gaming by Brendan Fosberry
Docker Links
DockerCon EU 2015: Sparebank; a journey towards Docker
DockerCon 2015: Docker Engine Breakout Session
Ad

Similar to Installing and Running Postfix within a Docker Container (20)

PDF
Rally_Docker_deployment_JumpVM
PDF
Creating docker custom image
PDF
Creating docker custom image
PDF
Docker in Action
PPTX
Dockerizing WordPress
PDF
Fedora Atomic Workshop handout for Fudcon Pune 2015
DOCX
Dockerfish-Tutorial
PDF
Docker by Example - Basics
PDF
Lab docker
PDF
Introduction to Docker
PDF
Getting Started with Docker
PDF
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
PPTX
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
PPTX
Dockerfile at Guidewire
PPTX
Academy PRO: Docker. Part 2
PDF
A Hands-on Introduction to Docker
PPTX
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
PPTX
Java microservicesdockerdockerhubusecase2
PPTX
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Rally_Docker_deployment_JumpVM
Creating docker custom image
Creating docker custom image
Docker in Action
Dockerizing WordPress
Fedora Atomic Workshop handout for Fudcon Pune 2015
Dockerfish-Tutorial
Docker by Example - Basics
Lab docker
Introduction to Docker
Getting Started with Docker
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile at Guidewire
Academy PRO: Docker. Part 2
A Hands-on Introduction to Docker
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
Java microservicesdockerdockerhubusecase2
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire

More from Docker, Inc. (20)

PDF
Containerize Your Game Server for the Best Multiplayer Experience
PDF
How to Improve Your Image Builds Using Advance Docker Build
PDF
Build & Deploy Multi-Container Applications to AWS
PDF
Securing Your Containerized Applications with NGINX
PDF
How To Build and Run Node Apps with Docker and Compose
PDF
Hands-on Helm
PDF
Distributed Deep Learning with Docker at Salesforce
PDF
The First 10M Pulls: Building The Official Curl Image for Docker Hub
PDF
Monitoring in a Microservices World
PDF
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
PDF
Predicting Space Weather with Docker
PDF
Become a Docker Power User With Microsoft Visual Studio Code
PDF
How to Use Mirroring and Caching to Optimize your Container Registry
PDF
Monolithic to Microservices + Docker = SDLC on Steroids!
PDF
Kubernetes at Datadog Scale
PDF
Labels, Labels, Labels
PDF
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
PDF
Build & Deploy Multi-Container Applications to AWS
PDF
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
PDF
Developing with Docker for the Arm Architecture
Containerize Your Game Server for the Best Multiplayer Experience
How to Improve Your Image Builds Using Advance Docker Build
Build & Deploy Multi-Container Applications to AWS
Securing Your Containerized Applications with NGINX
How To Build and Run Node Apps with Docker and Compose
Hands-on Helm
Distributed Deep Learning with Docker at Salesforce
The First 10M Pulls: Building The Official Curl Image for Docker Hub
Monitoring in a Microservices World
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
Predicting Space Weather with Docker
Become a Docker Power User With Microsoft Visual Studio Code
How to Use Mirroring and Caching to Optimize your Container Registry
Monolithic to Microservices + Docker = SDLC on Steroids!
Kubernetes at Datadog Scale
Labels, Labels, Labels
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Build & Deploy Multi-Container Applications to AWS
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
Developing with Docker for the Arm Architecture

Installing and Running Postfix within a Docker Container

  • 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