Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


fedora_20_docker

Fedora 20 Docker

Install and start Docker

From: http://goodsquishy.com/2014/01/playing-with-docker-on-fedora-20/

yum install docker-io
systemctl start docker
systemctl enable docker
  • Build a root file system for the container
    yum --installroot=/root/bbroot --releasever=20 install busybox
  • Remove cached data
    cd /root/bbroot/
    rm -rf ./var/cache/yum/* ./var/lib/yum/yumdb/* ./var/lib/yum/history/* ./var/log/yum.log
  • Build symlinks to busybox for the utilities it provides
    mkdir bin
    for linkname in $(./sbin/busybox --list) ; do ln -s /sbin/busybox bin/$linkname ; done
  • Import it into docker as a new image
    tar -czf - . | docker import - busybox:v1

And your done, you can now start your new container with the docker run command

docker images
docker run -t -i --name busybox busybox:v1 /bin/sh

Install Fedora container from registry

docker pull fedora
docker images
docker run -t -i fedora:20 /bin/bash 

Create Fedora container yourself

yum --installroot=/root/fedroot --releasever=20 install yum fedora-release coreutils
cd /root/fedroot/
rm -rf ./var/cache/yum/* ./var/lib/yum/yumdb/* ./var/lib/yum/history/* ./var/log/yum.log
tar -czf - . | docker import - myfedora:v1
docker run -t -i myfedora:v1 /bin/sh

Remove untagged container

docker rmi $(docker images | grep "^<none>" | awk "{print $3}") 

Attach running container

docker ps -a
docker start 344db3753522

#or by name
docker start busybox

docker attach busybox

Networking

Show bridge

yum install bridge-utils -y

brctl show
bridge name     bridge id               STP enabled     interfaces
docker0         8000.e2735138505f       no              veth64a0
fedora_20_docker.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1