Docker 備忘録†[edit]

see also†[edit]

どんなものか†[edit]

Wiki曰く、「Dockerはソフトウェアコンテナ内のアプリケーションのデプロイメントを自動化するオープンソースソフトウェアである。」らしい。

ミドルウェア以上のものをコンテナと呼ばれるもので仮想化する。

よく活用されている場面としては以下に記す。

 1.開発アプリケーションのバージョンアップや開発のとき

   ⇒現在のアプリケーション郡をコンテナに収容し、それをコピーすることで同じ環境で自由に触れる環境が出来上がる

     出来上がった環境をcommit?することで、本番環境へ切り替えも可能?

 2.運用中のサーバプログラムの更新

   ⇒現在動作中のサーバプログラム類をコンテナ化して、それをコピーしてパッチ、バージョンアップを検証できる


Install†[edit]

CentOS 8 (2021 7/25)†[edit]

# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# dnf -y install docker-ce docker-ce-cli containerd.io --nobest --allowerasing

CentOS8 入れ直し(21 7/3)†[edit]

リポジトリがあるようなので,それから入れなおす.†[edit]
# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# dnf -y install docker-ce docker-ce-cli containerd.io

For CentOS8†[edit]

CentOS8 の場合の事前準備 (2020 8/15)†[edit]
2023 1/17 CentOS8 の update で Docker が動かなくなったので上記の方法で入れ直し.(containerd.io が runc と競合する場合)†[edit]
もし podman が必要なら containerd.io をインストール後に,入れ直す.†[edit]
# yum install podman -y
# yum install toolbox -y
# yum install cockpit-podman -y
# yum install buildah -y
本体の Install & Getting Start†[edit]
# wget -qO- https://get.docker.com/ | sh
..............
# systemctl enable docker
# systemctl start docker
# docker run hello-world

or

# dnf install docker-ce
# systemctl enable docker
# systemctl start docker
# docker run hello-world

CentOS6†[edit]

Getting Start†[edit]

使ってみる†[edit]

Hello World†[edit]
# docker run hello-world
CentOSを使ってみる†[edit]
# docker pull centos
# docker images
# docker run -i -t centos /bin/bash
(DockerBash)#
CentOSを使ってみる2†[edit]
# docker pull centos:centos7
# docker run -ti -d --name centos7 centos:centos7
# docker exec -it centos7 /bin/bash
[root@fbd5aeb4046a /]#

Local Registry†[edit]

コマンド†[edit]

操作†[edit]

コンテナ†[edit]
ボリューム(永続ストレージ)†[edit]
イメージ†[edit]
退避と復元†[edit]
使用していない(孤立した)リソースの削除†[edit]

 Tips†[edit]

Health check[edit]

Podman default[edit]

ファイル(Volume)共有†[edit]

none タグのイメージの名前(表示)を消す.†[edit]

現在の環境が Docker のコンテナなのかを確認する.†[edit]

cockpit-docker†[edit]

Tools†[edit]

Networkの初期化スクリプト†[edit]
#!/bin/sh
rm -r /var/lib/docker/network/files/*
systemctl restart docker

Dockerデーモン(dockerd) のリモート操作†[edit]

最善策†[edit]
* ボツ SSH ポートフォワードを使用する.†[edit]
* ボツ docker の通信機能を使用する†[edit]

Dcoker 内から DNSが引けない (その他のサービスも同様)†[edit]

/etc/resolv.conf†[edit]

Jupyter†[edit]

Docker Images†[edit]

jupyterhub/singleuser†[edit]
jupyter/datascience-notebook†[edit]
jupyter/tensorflow-notebook†[edit]
rattydave/jupyterhub†[edit]
joequant/bitstation:latest†[edit]

jupyterhub/singleuser†[edit]

/opt/conda/bin/conda update --prefix /opt/conda --all -y
apt-get update -y
apt-get upgrade -y
apt-get install vim -y
apt-get install subversion -y
apt-get install make -y
apt-get install automake -y
apt-get install gcc -y
apt-get install zlib1g-dev -y
apt-get install mlocate -y

docker commit すると,起動時のオプション(arguments)まで保存する.†[edit]

Trouble†[edit]

Jupyter で色々やっていたらコンテナが続々と自動生成->消滅 を繰り返している†[edit]

Trouble Shooting†[edit]

Dockerfile[edit]

conda-libmamba-solver (libarchive.so.19: cannot open shared object file: No such file or directory)[edit]

良く分かっていなかった頃のエラーなので,勘違いしているかもしれない†[edit]

docker run実行時のiptablesエラー†[edit]
Dockerfile による RUNで,pipがNewConnectionError を出す.†[edit]
 

トップ   新規 ページ一覧 検索 最終更新   ヘルプ   最終更新のRSS