0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

docker の備忘録

Last updated at Posted at 2020-04-25

 概要`

Docker周りの備忘録を書き、随時更新していきます。

記録

remote ssh できるようにセットアップ

apt-get update &&\
apt-get install -y openssh-server &&\
mkdir ~/.ssh && \
echo 'root:password' | chpasswd &&\
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config &&\
/etc/init.d/ssh restart

この時、~/.ssh フォルダの下にauthorized_keys を作り、公開鍵情報を書き込む。
詳しくはhttps://qiita.com/kenmaro/items/a548a302228029c5c870  

docker と docker-compose を ubuntu18.04 にインストール 

https://qiita.com/iganari/items/fe4889943f22fd63692a
まとめていただきありがとうございます。

sudo apt update &&\
sudo apt install -y \
     apt-transport-https \
     ca-certificates \
     curl \
     software-properties-common &&\
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - &&\
sudo add-apt-repository \
     "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
     $(lsb_release -cs) \
     stable" &&\

sudo apt update &&\
sudo apt install -y docker-ce &&\
export compose='1.25.5' &&\
sudo curl -L https://github.com/docker/compose/releases/download/${compose}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose &&\

sudo chmod 0755 /usr/local/bin/docker-compose

をやって、

sudo systemctl status docker
docker-compose -v

などをやって確かめる。

docker image を tar file でエクスポート


docker save <docker_image_name> -o <docker_image_name>.tar

エクスポートされた image を ロードする

docker load < <docker_image_name>.tar

上のロードしたイメージをコンポーズアップするときのエラー

[6] Error loading Python lib '/tmp/_MEItTTce4/libpython3.6m.so.1.0': dlopen: libexpat.so.1: cannot open shared object file: No such file or directory

docker コンテナをそのままイメージにする

docker export <container id> > <file name>
cat <file name> | docker import <image name>:latest

docker in docker できるように第一コンテナをランする


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?