title: “Source Files in Container”
date: 2022-05-31T12:45:05
slug: source-files-in-container
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
title: “Source Files in Container”
date: 2022-05-31T12:45:05
slug: source-files-in-container
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
title: “non interactive apt”
date: 2020-03-04T15:43:37
slug: non-interactive-apt
if [ -x /usr/bin/apt ]; then
apt update -qq
DEBIAN\_FRONTEND=noninteractive apt-get install -y -qq awscli curl gettext-base git jq openssh-client sudo wget > /dev/null
fi
title: “invoke-rc.d: policy-rc.d denied execution of start.”
date: 2016-04-22T09:09:23
slug: invoke-rc-d-policy-rc-d-denied-execution-of-start
invoke-rc.d: policy-rc.d denied execution of start.
This page gives a solution: edit contents of /usr/sbin/policy-rc.d, to replace exit 101 by exit 0.
title: “Persistent Storage”
date: 2016-03-27T15:41:45
slug: persistent-storage
Attach a Host Directory to the Container
Create a volume container:
docker create -v /dbdata --name dbstore ubuntu /bin/true
Start a container with the volume container attached
docker run -d --volumes-from dbstore --name ubuntu ubuntu
Start a second container with the same volume container (shared)
docker run -d --volumes-from dbstore --name ubuntu2 ubuntu
You can use multiple --volumes-from parameters
Make a backup from the volume
docker run --rm --volumes-from ubuntu -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata
Restore the backup into a container
docker run -v /dbdata --name dbstore2 ubuntu /bin/bash
docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1"
title: “Build a new Image from Dockerfile”
date: 2016-03-25T17:40:02
slug: build-a-new-image-from-dockerfile
vi Dockerfile
With this content
# This is a comment
FROM ubuntu:14.04
MAINTAINER Kate Smith <ksmith@example.com>
RUN apt-get update && apt-get install -y apache2
RUN touch /example
Then build the new Image:
docker build -t thomas/ubuntu:v2 .
title: “Update CoreOS”
date: 2016-03-24T13:45:37
slug: update-coreos
vi /etc/coreos/update.conf
and add after the line “GROUP=”
SERVER=https://customer.update.core-os.net/v1/update/
systemctl restart update-engine
$ update\_engine\_client -check\_for\_update
[0123/220706:INFO:update\_engine\_client.cc(245)] Initiating update check and install.
If you want to see what’s going on behind the scenes, you can watch the ouput in the foreground:
$ update\_engine\_client -update
[0123/222449:INFO:update\_engine\_client.cc(245)] Initiating update check and install.
[0123/222449:INFO:update\_engine\_client.cc(250)] Waiting for update to complete.
LAST\_CHECKED\_TIME=0
PROGRESS=0.000000
CURRENT\_OP=UPDATE\_STATUS\_IDLE
NEW\_VERSION=0.0.0.0
NEW\_SIZE=0
[0123/222454:ERROR:update\_engine\_client.cc(189)] Update failed.
Be aware that the “failed update” means that there isn’t a newer version to install.
title: “docker commands”
date: 2016-03-24T12:52:14
slug: docker-commands
Show running docker instances with ID
docker ps
Show running docker instances with ID (History)
docker ps -a
Show the last running container
docker ps -l
Start an Docker Instance (from ‘docker ps -a’)
docker run 4dcecf77c564
Committing a docker instance:
docker commit a589d9df44ec coreos/apache
while a589d9df44ec is the ID listed with “docker ps” Stop docker instance
docker stop 4ecbf72df071
Alle Container löschen
docker rm `docker ps -qa`
Einen Befehl in einem Container ausführen
docker exec -it db bash
List Images
docker images
stdout eines Containers anzeigen
docker logs 9f5aafa2536b
Ports eines Containers anzeigen
docker port 1a109a55a86d
Prozesse in einem Container anzeigen
docker top
Statusinformationen eines Containers anzeigen
docker inspect 1a109a55a86d
Remove a Container from the bridge
docker network disconnect bridge <containername>
Create an own bridged network
docker network create -d bridge my-bridge-network
List Networks
docker network ls
Details/Inspect a network
docker network inspect my-bridge-network
Attach network to a container
docker network connect my-bridge-network web
Attach Data Volume to a container
docker run --name ubuntu -v /webmount -it ubuntu /bin/bash
Attach Host Directory to a container
docker run --name ubuntu -v /home/webapp:/webmount -it ubuntu /bin/bash
d
title: “Start an ubuntu docker instance , install and configure Apache”
date: 2016-03-24T12:50:08
slug: start-an-ubuntu-docker-instance-install-and-configure-apache
Start an Ubuntu instance (simple shell)
docker run -t -i ubuntu /bin/bash
The -t and -i flags allocate a pseudo-tty and keep stdin open even if not attached.
Update Repository anstall Apache
apt-get update && apt-get install apache2
f
title: “Network Configuration CoreOS”
date: 2016-03-24T12:21:58
slug: network-configuration-coreos
Network configuration is stored in:
/etc/systemd/network
Create a bridge:
vi 5.netdev
[NetDev]
Name=docker0
Kind=bridge
Configure ens3 as bridge interface
vi 10-ens3.network
[Match]
Name=ens3
[Network]
Bridge=docker0
Configure Bridge Interface
vi 15-br.network
[Match]
Name=docker0
[Network]
Address=10.86.0.27/23
Gateway=10.86.0.250
[Route]
Gateway=10.86.0.1
Destination=10.0.0.0/8
[Route]
Gateway=10.86.0.1
Destination=172.16.0.0/12
[Route]
Gateway=10.86.0.1
Destination=192.168.0.0/16
Configure static Nameserver
vi resolved.conf
[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#LLMNR=yes