Docker: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 22: Line 22:
  yum -y install firefox
  yum -y install firefox
  yum -y install https://www.halfface.se/jdk-8u40-linux-i586.rpm
  yum -y install https://www.halfface.se/jdk-8u40-linux-i586.rpm
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 200000
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000
ln -sf /usr/lib/mozilla/plugins/libjavaplugin.so /etc/alternatives/libjavaplugin.so
*Search for images.
*Search for images.
  docker search fedora
  docker search fedora

Revision as of 19:58, 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.

sudo docker run -i -t -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --rm marina/fedora21-i386 /bin/bash

Update image

sed -i 's/\$releasever/21/g;s/\$basearch/i386/g' /etc/yum.repos.d/*
yum clean all
yum -y update
yum -y install firefox
yum -y install https://www.halfface.se/jdk-8u40-linux-i586.rpm
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 200000
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000
ln -sf /usr/lib/mozilla/plugins/libjavaplugin.so /etc/alternatives/libjavaplugin.so
  • Search for images.
docker search fedora

attach container

List containers.

sudo docker ps
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS               NAMES
315ea401e287        marina/fedora21-i386:0.1.0   "/bin/bash"         About an hour ago   Up About an hour                        elated_nobel        

Connect container,

sudo docker attach 315ea401e287