ラベル docker の投稿を表示しています。 すべての投稿を表示
ラベル docker の投稿を表示しています。 すべての投稿を表示

2024/02/28

2024/01/09

2019/12/25

docker image build Dockerfile

docker-compse.yml 内で定義  go のimage
image:xxx/xxx ->直接pull して使う

imageを調査する
 履歴調査 docker image history image_name
 構成調査 docker image inspect image_name

build a image from dockerfile
 docker build --help 

Dockerfile 原則
 1. container from Dockerfile  is ephemeral
 2. one container one process (easy to scale  horizontally)
 3. minimize container layer ( use one-line command. one command one layer)

   RUN apt-get update && apt-get install -y \
  bzr \
  cvs \
  git \
  mercurial \
  subversion

 4. docker build dockerfile_path (---no-cache=true)
     run commands in dockerfile to create layer.
     but first to search cache (sha256のchecksumがあり)あれば、使う。 

2019/12/24

docker mac performance

docker use linux kernel almost as native, so performance is well.
in mac or windows, things are different. there is no linux kernel.
so some helper needed.

docker-machine:   a tool to install docker in virtual machine. Dockerized hosts (hosts with Docker Engine on them).

docker for Mac/Windows:  even still run a virtual machine (super hidden ).with its own hypervisor “hyperkit” and shared file system “osxfs”. Unfortunately, “osxfs” wasn’t very fast.

but in many cases, realtime host-virtual consistence is not necessary.
So options come
 host first docker run -v hostDir1:/virtualDir1:cached  
 virtual first docker run -v hostDir1:/virtualDir1:delegated
 realTime run -v hostDir1:/virtualDir1:consistent 

docker run exec

「docker run」コマンドは、コンテナを作成して起動するコマンド。
docker run  -it image_name "/bin/bash"
他のTabでdocker ps
Containerが増える。
実質は:
     docker create image_name
    docker start image_name


「docker exec」コマンドは、起動中のコンテナ内で、指定したコマンドを実行するコマンド。
docker ps
docker exec -it container_id "/bin/bash"




docker-run options image_name init_command
-- name (起動されたContainerに名前)
-- rm (Container終了時削除)
-v  fromHostSrc:toContainerTarget-e   env parameters
-d  run in backend

docker-sync start サンプル:
docker run --rm -v "dir1:/app_sync" -v "dir2:/host_sync" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync -e TZ=$(basename $(dirname `readlink /etc/localtime`))/$(basename `readlink /etc/localtime`) -e UNISON_SRC="/host_sync" -e UNISON_DEST="/app_sync" -e UNISON_ARGS=" -ignore='Name .git' -ignore='Name .idea' -ignore='Name mysql_data' -prefer /host_sync -numericids -auto -batch" -e UNISON_WATCH_ARGS="-repeat watch"  --name backend-service eugenmayer/unison:2.51.2.1 /usr/local/bin/precopy_appsync

試しに一回起動してすぐ削除されたので、また起動
docker run -d -v "dir1:/app_sync" -v "dir2:/host_sync" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync -e TZ=$(basename $(dirname `readlink /etc/localtime`))/$(basename `readlink /etc/localtime`) -e UNISON_SRC="/host_sync" -e UNISON_DEST="/app_sync" -e UNISON_ARGS=" -ignore='Name .git' -ignore='Name .idea' -ignore='Name mysql_data' -prefer /host_sync -numericids -auto -batch" -e UNISON_WATCH_ARGS="-repeat watch"  --name backend-service eugenmayer/unison:2.51.2.1



2019/12/20

docker show all container ,delete all



  • docker show all container :     docker container ls -a
  • docker show volume:   docker volume ls 
  • docker show image: docker image ls
  • delete all unused objects:        docker system prune -f --volumes
  • delete all images:  docker image prune -a
  • docker-compose up -d  --remove-orphans
スキリした。普通に30Gぐらい削除した。unusedの基準は曖昧かな


2019/09/25

docker-sync ruby error

xcodeアップデートしますかを聞かれて、アップデートした。
docker-syncがエラー

docker-sync start
mkmf.rb can't find header files 

ruby versionの管理が混乱になっている。
rbenvを導入

 brew update
 brew install rbenv ruby-build
rbenv install -l
rbenv install 2.6.4
エラー、BUILD FAILED (OS X 10.。。。。
sudo chmod -s /usr/sbin/dtrace
RUBY_CONFIGURE_OPTS="--disable-dtrace" rbenv install
でrubyをインストールできた。
which gem
which ruby
gem list
gem install docker-compose
gem install docker-sync
でOK

2019/02/10

k8s message=Required "container.clusters.get" permission(s) for

circleICIの作業でGCR PUSH、K8S Deployの作業で、権限がない言われた。。
適切にCI のServiceAccountに
```
Kubernetes Engine Admin
Kubernetes Engine Cluster Admin
Storage Admin
Storage Object Viewer
```
を与えが、、それで権限ないで意味がわからない。。。イライラ

で、CI ServiceAccountを削除して、作り直し、だめ。。。
で、違う名前のCI ServiceAccountを作成して、OK
意味がわからない。。。

推測で、検証待ち。。
昔、誰が、権限がない同じ名前のCI用ServiceAccountを作成したことがあるからだめが、、

2018/10/16

docker gae EMPTRY_RESPONSE


docker+gaeの構成で、Admin Consoleを見たいが、EMPTRY_RESPONSEで見えない。。

EMPTRY_RESPONSE means that the TCP connection into the docker container seemed to be sucessful, 
however the server side closed the connection without sending anything back. 

curl -v http://localhost:8000 


Your issue is that you are binding to the 127.0.0.1:8025 inside your code. This makes the code work from inside the container but not outside.
You need to bind to 0.0.0.0:8025 to bind to all interfaces inside the container. So traffic coming from outside of the container is also accepted by your Go app

When you get this error it means youve exposed the right port in your Dockerfile, 
but you have to make sure the app within your container is binding to 0.0.0.0 instead of localhost or 127.0.0.1.
I got this error using Angular CLIng serve within a container. 
I had to add –host=0.0.0.0 to the ENTRYPOINT arguments. 
If youre using a different framework check for a similar command-line argument, configuration parameter or setting.

・解決!—port 8080 --admin_port 8000 --skip_sdk_update_check yes --host 0.0.0.0
--admin_hostデフォルトはlocalhost—admin_host 0.0.0.0 を追加して見える
--admin_host=ADMIN_HOST
ローカル開発用サーバーの管理コンソールがバインドするホスト名(デフォルト: localhost)。
--admin_port=ADMIN_PORT