“Docker build”的版本间的差异
跳到导航
跳到搜索
(未显示同一用户的9个中间版本) | |||
第3行: | 第3行: | ||
<pre> | <pre> | ||
+ | |||
+ | 先登录 | ||
+ | docker login | ||
+ | evan886 evan22 | ||
+ | |||
+ | |||
+ | |||
+ | cd /data/builddocker/mysql/5.7 | ||
+ | /data/builddocker/mysql/5.7# ls | ||
+ | docker-entrypoint.sh Dockerfile | ||
+ | |||
+ | docker build --tag evan886/mysql5.7:v1 -f Dockerfile . | ||
+ | |||
+ | docker push evan886/mysql5.7:v1 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
docker push evan886/ubuntu14 | docker push evan886/ubuntu14 | ||
The push refers to repository [docker.io/evan886/ubuntu14] | The push refers to repository [docker.io/evan886/ubuntu14] | ||
第11行: | 第32行: | ||
+ | ==2023 example == | ||
+ | <pre> | ||
+ | root@myxps:/home/evan/data/dockerbuild/sep2023/phpinfo# ls | ||
+ | Dockerfile index.php | ||
+ | root@myxps:/home/evan/data/dockerbuild/sep2023/phpinfo# cat Dockerfile | ||
+ | # syntax=docker/dockerfile:1 | ||
+ | FROM php:8.1-fpm | ||
+ | #FROM --platform=$TARGETPLATFORM php:8.1-fpm | ||
+ | WORKDIR /app | ||
+ | COPY index.php /app | ||
+ | root@myxps:/home/evan/data/dockerbuild/sep2023/phpinfo# cat index.php | ||
+ | <?php | ||
+ | echo 'from evan linuxsa.org'; | ||
+ | phpinfo(); | ||
+ | |||
+ | ?> | ||
+ | |||
+ | docker build --tag evan886/phpinfo -f Dockerfile . | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </pre> | ||
[https://www.cnblogs.com/ee900222/p/docker_3.html Docker系列之(三):Docker微容器Alpine Linux] | [https://www.cnblogs.com/ee900222/p/docker_3.html Docker系列之(三):Docker微容器Alpine Linux] | ||
− | = | + | =see also Docker Dockerfile= |
+ | [[Dockerfile]] | ||
+ | [https://www.runoob.com/docker/docker-dockerfile.html Docker Dockerfile ] | ||
+ | |||
+ | =references= | ||
+ | |||
+ | |||
+ | [https://www.cnblogs.com/sowler/p/17352865.html 使用Dockerfile部署springboot打包jar包] | ||
+ | [https://www.cnblogs.com/liftsail/p/16087127.html docker打包jar包,构建镜像部署运行] | ||
+ | |||
+ | [https://www.okcode.net/article/41799 官方镜像利用commit制作自己的镜像并上传docker hub] | ||
[http://www.xiaomastack.com/2015/04/05/docker-dev-test-build/ Docker build搭建开发测试环境_编译镜像] | [http://www.xiaomastack.com/2015/04/05/docker-dev-test-build/ Docker build搭建开发测试环境_编译镜像] | ||
+ | |||
+ | [https://blog.csdn.net/l1028386804/article/details/109001118 通过Dockerfile打包Jar镜像,看这一篇就够了] | ||
[[category:ops]] [[category:容器]] [[category: container]] | [[category:ops]] [[category:容器]] [[category: container]] |
2024年10月8日 (二) 03:42的最新版本
建议以 Alpine Linux 作为基础打包
先登录 docker login evan886 evan22 cd /data/builddocker/mysql/5.7 /data/builddocker/mysql/5.7# ls docker-entrypoint.sh Dockerfile docker build --tag evan886/mysql5.7:v1 -f Dockerfile . docker push evan886/mysql5.7:v1 docker push evan886/ubuntu14 The push refers to repository [docker.io/evan886/ubuntu14] Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 223.6.6.6:53: read udp 192.168.10.199:42959->223.6.6.6:53: i/o timeout 后来dns 改为8.8.8.8就好了呀
2023 example
root@myxps:/home/evan/data/dockerbuild/sep2023/phpinfo# ls Dockerfile index.php root@myxps:/home/evan/data/dockerbuild/sep2023/phpinfo# cat Dockerfile # syntax=docker/dockerfile:1 FROM php:8.1-fpm #FROM --platform=$TARGETPLATFORM php:8.1-fpm WORKDIR /app COPY index.php /app root@myxps:/home/evan/data/dockerbuild/sep2023/phpinfo# cat index.php <?php echo 'from evan linuxsa.org'; phpinfo(); ?> docker build --tag evan886/phpinfo -f Dockerfile .
Docker系列之(三):Docker微容器Alpine Linux
see also Docker Dockerfile
references
使用Dockerfile部署springboot打包jar包