This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
технология_docker [2025/02/20 06:43] val [Создание образа для приложения с использованием Dockerfile] |
технология_docker [2025/03/04 11:46] (current) val [Инструмент kaniko] |
||
---|---|---|---|
Line 79: | Line 79: | ||
* [[Сервис Grafana]] | * [[Сервис Grafana]] | ||
==== Обзор и удаление ==== | ==== Обзор и удаление ==== | ||
+ | |||
+ | * [[https://forums.docker.com/t/why-arent-base-layer-images-listed-in-docker-image-ls-a/139044/5|Why aren’t base layer images listed in `docker image ls -a`?]] | ||
<code> | <code> | ||
Line 247: | Line 249: | ||
<code> | <code> | ||
- | :~/pywebd$ ### mkdir -p etc/pywebd/; cp -rv /etc/pywebd/ etc/pywebd/ | + | :~/pywebd$ ### mkdir etc/; cp -rv /etc/pywebd/ etc/ |
:~/pywebd$ ### echo '<h1>Hello from pywebd</h1>' > index.html | :~/pywebd$ ### echo '<h1>Hello from pywebd</h1>' > index.html | ||
Line 274: | Line 276: | ||
#COPY --chown=myuser:myuser app.py . | #COPY --chown=myuser:myuser app.py . | ||
- | #COPY --chown=myuser:myuser etc/pywebd/ /etc/ | + | ### COPY --chown=myuser:myuser etc/pywebd/ /etc/pywebd/ |
- | #COPY --chown=myuser:myuser index.html /var/www/ | + | ### COPY --chown=myuser:myuser index.html /var/www/ |
### ADD www.tgz /var/ | ### ADD www.tgz /var/ | ||
Line 287: | Line 289: | ||
:~/pywebd$ time docker build -t pywebd . | :~/pywebd$ time docker build -t pywebd . | ||
+ | :~/pywebd$ ### docker run -ti --rm --entrypoint /bin/sh pywebd | ||
:~/pywebd$ ### docker run -p 4443 -d --rm pywebd | :~/pywebd$ ### docker run -p 4443 -d --rm pywebd | ||
Line 666: | Line 669: | ||
<code> | <code> | ||
~/gowebd# time docker run \ | ~/gowebd# time docker run \ | ||
- | -v $(pwd):/workspace --rm\ | + | -v $(pwd):/workspace \ |
+ | -v ~/.docker/config.json:/kaniko/.docker/config.json \ | ||
gcr.io/kaniko-project/executor:latest \ | gcr.io/kaniko-project/executor:latest \ | ||
- | --skip-tls-verify --log-timestamp\ | + | --skip-tls-verify --log-timestamp \ |
--dockerfile=./Dockerfile \ | --dockerfile=./Dockerfile \ | ||
--context=/workspace \ | --context=/workspace \ | ||
- | --destination=server.corp13.un:5000/student/gowebd \ | + | --destination=server.corpX.un:5000/student/gowebd |
- | --cache=true --cache-copy-layers --cache-repo server.corp13.un:5000/dev-cache --use-new-run \ | + | |
- | --verbosity debug | + | |
</code><code> | </code><code> | ||
или, интерактивно: | или, интерактивно: | ||
Line 679: | Line 681: | ||
root@ubuntu:~/gowebd# docker run -it \ | root@ubuntu:~/gowebd# docker run -it \ | ||
-v $(pwd):/workspace --rm --entrypoint "/bin/sh" \ | -v $(pwd):/workspace --rm --entrypoint "/bin/sh" \ | ||
+ | -v ~/.docker/config.json:/kaniko/.docker/config.json \ | ||
gcr.io/kaniko-project/executor:debug | gcr.io/kaniko-project/executor:debug | ||
Line 684: | Line 687: | ||
--dockerfile=./Dockerfile \ | --dockerfile=./Dockerfile \ | ||
--context=/workspace \ | --context=/workspace \ | ||
- | --destination=server.corp13.un:5000/student/gowebd | + | --destination=server.corpX.un:5000/student/gowebd |
</code><code> | </code><code> | ||
тестируем результат: | тестируем результат: | ||
</code><code> | </code><code> | ||
# docker run --pull=always --name gowebd -itd --rm \ | # docker run --pull=always --name gowebd -itd --rm \ | ||
- | -p 8000:80 server.corp13.un:5000/student/gowebd | + | -p 8000:80 server.corpX.un:5000/student/gowebd |
</code> | </code> | ||
==== Приложение apwebd ==== | ==== Приложение apwebd ==== |