Docker: Difference between revisions

From Halfface
Jump to navigation Jump to search
(Created page with "Step 1: Install Docker on Fedora 21 *As a matter of best practice, we’ll update our packages: yum update -y *Let’s install Docker by installing the docker-io package: yu...")
 
No edit summary
Line 10: Line 10:
*Step 2: Download a Docker Container
*Step 2: Download a Docker Container
  docker pull marina/fedora21-i386
  docker pull marina/fedora21-i386
*Step 3: Run a Docker Container
==Step 3: Run a Docker Container==
basic fedora container with a bash shell, we just run one command. docker run will run a command in a new container, -i attaches stdin and stdout, -t allocates a tty, and we’re using the standard fedora  
basic fedora container with a bash shell, we just run one command. docker run will run a command in a new container, -i attaches stdin and stdout, -t allocates a tty, and we’re using the standard fedora  
  docker run -i -t marina/fedora21-i386 /bin/bash
  docker run -i -t marina/fedora21-i386 /bin/bash
connect, or detach, from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q.
connect, or detach, from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q.
==Update image==
sed -i 's/\$releasever/21/g;s/\$basearch/i386/g' /etc/yum.repos.d/*
yum clean all
yum -y update
*Search for images.
*Search for images.
  docker search fedora
  docker search fedora

Revision as of 06:56, 28 March 2015

Step 1: Install Docker on Fedora 21

  • As a matter of best practice, we’ll update our packages:
yum update -y
  • Let’s install Docker by installing the docker-io package:
yum -y install docker-io
  • Once the installation completes, we’ll need to start the Docker daemon:
systemctl start docker
  • And finally, and optionally, let’s configure Docker to start when the server boots:
systemctl enable docker
  • Step 2: Download a Docker Container
docker pull marina/fedora21-i386

Step 3: Run a Docker Container

basic fedora container with a bash shell, we just run one command. docker run will run a command in a new container, -i attaches stdin and stdout, -t allocates a tty, and we’re using the standard fedora

docker run -i -t marina/fedora21-i386 /bin/bash

connect, or detach, from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q.

Update image

sed -i 's/\$releasever/21/g;s/\$basearch/i386/g' /etc/yum.repos.d/*
yum clean all
yum -y update
  • Search for images.
docker search fedora