티스토리 뷰
$ docker run -it --name cowsay --hostname cowsay debian bash
root@cowsay:/# apt-get update
cowsay fortuneroot@cowsay:/# apt-get install -y
root@cowsay:/# /usr/games/fortune | /usr/games/cowsay
________________________________________
/ ... A solemn, unsmiling, sanctimonious \
| old iceberg who looked like he was |
| waiting for a vacancy in the Trinity. |
| |
\ -- Mark Twain /
----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
$ docker commit cowsay test/cowsayimage
sha256:a07478457b89f1ae08fc65360987d3a675e544e1d0333c0fea21f36b7f5a6bd9
$ docker run test/cowsayimage /usr/games/cowsay "Moo"
_____
< Moo >
-----
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
$ cat Dockerfile
FROM debian:wheezy
RUN apt-get update && apt-get install -y cowsay fortune
$ docker build -t test/cowsay-dockerfile .
$ docker run test/cowsay-dockerfile /usr/games/cowsay "Moo"
_____
< Moo >
-----
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
$ docker info
Containers: 9
Running: 1
Paused: 0
Stopped: 8
Images: 16
Server Version: 18.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: ZD3Z:I2BF:UXMM:SEHS:NZZ4:ZQVK:U7XJ:GHUX:O5WJ:DXBW:A7RQ:U2ZT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 22
Goroutines: 41
System Time: 2018-07-09T02:19:20.006046842Z
EventsListeners: 2
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
docker run하면 특정 command 실행시키도록 ENTRYPOINT 지정
$ cat Dockerfile
FROM debian:wheezy
RUN apt-get update && apt-get install -y cowsay fortune
ENTRYPOINT ["/usr/games/cowsay"]
$ cat entrypoint.sh
#!/bin/bash
if [ $# -eq 0 ]; then
/usr/games/fortune | /usr/games/cowsay
else
/usr/games/cowsay "$@"
fi
$ cat Dockerfile
FROM debian:wheezy
RUN apt-get update && apt-get install -y cowsay fortune
# copy host's entrypoint.sh to image's file system
# 1st arg is host's file, 2nd arg is image's path
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
$ chmod +x entrypoint.sh
$ docker build -t xxxx/cowsay .
Sending build context to Docker daemon 3.072kB
Step 1/4 : FROM debian:wheezy
---> 8f8122a1c206
Step 2/4 : RUN apt-get update && apt-get install -y cowsay fortune
---> Using cache
---> 249f7a895e02
Step 3/4 : COPY entrypoint.sh /
---> Using cache
---> 17256aa54c11
Step 4/4 : ENTRYPOINT ["/entrypoint.sh"]
---> Using cache
---> 7af0d077f7e6
Successfully built 7af0d077f7e6
Successfully tagged xxxx/cowsay:latest
$ docker push xxxx/cowsay
The push refers to repository [docker.io/xxxx/cowsay]
cac0325bc52a: Pushed
02e661870bb0: Pushed
76d132c56f63: Mounted from library/debian
latest: digest: sha256:4e7b218528ab9abb6bd5d6e896f1834d3304114bcee23367b5c6b9b18a9fe29d size: 948
$ docker build -t xxxx/cowsay:stable
$docker pull xxxx/cowsay
'Programming > Tools' 카테고리의 다른 글
docker-machine boot2docker sudo (0) | 2018.07.23 |
---|---|
docker redis (836) | 2018.07.09 |
docker command basic (756) | 2018.07.09 |
lombok.javac.apt.LombokProcessor could not be initialized. Lombok will not run during this compilation (0) | 2018.06.12 |
Intellij build를 gradle로 위임하기 (575) | 2018.06.12 |
- Total
- Today
- Yesterday
- IntelliJ
- Ansible
- Netty
- pymongo
- docker-machine
- X-Pack
- AWS
- Spring Boot
- spring #lombok
- Paw
- mecab
- TDD
- git
- boot2docker
- MacOS
- MongoDB
- PIP
- PubSub
- docker
- 은전한닢
- kubernetes
- zsh
- scrapy
- Redis
- Python
- GCP
- xpath
- ansible-container
- Elasticsearch
- pycharm
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |