• 欢迎光临~

docker build

开发技术 开发技术 2022-06-07 次浏览
[ec2-user@ip-10-0-0-134 ~]$ docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[ec2-user@ip-10-0-0-134 ~]$ docker images
REPOSITORY                TAG       IMAGE ID       CREATED       SIZE
amazonlinux               latest    ecdeb69c57ad   4 weeks ago   164MB
[ec2-user@ip-10-0-0-134 ~]$ vim Dockerfile
[ec2-user@ip-10-0-0-134 ~]$ docker build -t test .
Sending build context to Docker daemon  355.8kB
Step 1/4 : FROM amazonlinux:latest
 ---> ecdeb69c57ad
Step 2/4 : RUN yum install -y wget  && wget http://host.httap.com:8001/images/demo/server_demo -O /root/server_demo && wget http://host.httap.com:8001/images/demo/conf.toml  -O /root/conf.toml && chmod a+x /root/server_demo
 ---> Running in a9d7f740a4ef
Loaded plugins: ovl, priorities
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.amzn2.1 will be installed
--> Processing Dependency: libidn.so.11(LIBIDN_1.0)(64bit) for package: wget-1.14-18.amzn2.1.x86_64
--> Processing Dependency: libidn.so.11()(64bit) for package: wget-1.14-18.amzn2.1.x86_64
--> Running transaction check
---> Package libidn.x86_64 0:1.28-4.amzn2.0.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch          Version                    Repository         Size
================================================================================
Installing:
 wget          x86_64        1.14-18.amzn2.1            amzn2-core        547 k
Installing for dependencies:
 libidn        x86_64        1.28-4.amzn2.0.2           amzn2-core        209 k

Transaction Summary
================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 757 k
Installed size: 2.6 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              5.8 MB/s | 757 kB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libidn-1.28-4.amzn2.0.2.x86_64                               1/2
  Installing : wget-1.14-18.amzn2.1.x86_64                                  2/2
  Verifying  : wget-1.14-18.amzn2.1.x86_64                                  1/2
  Verifying  : libidn-1.28-4.amzn2.0.2.x86_64                               2/2

Installed:
  wget.x86_64 0:1.14-18.amzn2.1

Dependency Installed:
  libidn.x86_64 0:1.28-4.amzn2.0.2

Complete!
--2022-06-07 05:55:54--  http://host.httap.com:8001/images/demo/server_demo
Resolving host.httap.com (host.httap.com)... 139.196.94.34
Connecting to host.httap.com (host.httap.com)|139.196.94.34|:8001... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7072648 (6.7M) [application/octet-stream]
Saving to: '/root/server_demo'

     0K .......... .......... .......... .......... ..........  0%  602K 11s
    50K .......... .......... .......... .......... ..........  1% 1.17M 9s
   100K .......... .......... .......... .......... ..........  2% 1.16M 8s
   150K .......... .......... .......... .......... ..........  2% 75.0M 6s
   200K .......... .......... .......... .......... ..........  3% 1.18M 6s
   250K .......... .......... .......... .......... ..........  4% 89.4K 17s
   300K .......... .......... .......... .......... ..........  5% 90.2K 25s
   350K .......... .......... .......... .......... ..........  5%  593K 23s
   400K .......... .......... .......... .......... ..........  6%  117K 26s
   450K .......... .......... .......... .......... ..........  7%  396K 25s
   500K .......... .......... .......... .......... ..........  7% 81.9K 30s
   550K .......... .......... .......... .......... ..........  8% 97.1K 32s
   600K .......... .......... .......... .......... ..........  9%  397K 31s
   650K .......... .......... .......... .......... .......... 10% 81.9K 34s
   700K .......... .......... .......... .......... .......... 10%  297K 33s
   750K .......... .......... .......... .......... .......... 11%  237K 32s
   800K .......... .......... .......... .......... .......... 12% 89.5K 34s
   850K .......... .......... .......... .......... .......... 13%  297K 33s
   900K .......... .......... .......... .......... .......... 13% 89.6K 34s
   950K .......... .......... .......... .......... .......... 14%  238K 34s
  1000K .......... .......... .......... .......... .......... 15%  396K 32s
  1050K .......... .......... .......... .......... .......... 15% 83.0K 34s
  1100K .......... .......... .......... .......... .......... 16%  297K 33s
  1150K .......... .......... .......... .......... .......... 17% 77.0K 34s
  1200K .......... .......... .......... .......... .......... 18%  237K 34s
  1250K .......... .......... .......... .......... .......... 18% 88.8K 35s
  1300K .......... .......... .......... .......... .......... 19%  297K 34s
  1350K .......... .......... .......... .......... .......... 20% 89.8K 34s
  1400K .......... .......... .......... .......... .......... 20%  238K 34s
  1450K .......... .......... .......... .......... .......... 21%  396K 33s
  1500K .......... .......... .......... .......... .......... 22% 82.5K 33s
  1550K .......... .......... .......... .......... .......... 23% 83.4K 34s
  1600K .......... .......... .......... .......... .......... 23%  298K 33s
  1650K .......... .......... .......... .......... .......... 24%  297K 33s
  1700K .......... .......... .......... .......... .......... 25% 83.1K 33s
  1750K .......... .......... .......... .......... .......... 26%  297K 32s
  1800K .......... .......... .......... .......... .......... 26% 90.5K 33s
  1850K .......... .......... .......... .......... .......... 27%  297K 32s
  1900K .......... .......... .......... .......... .......... 28% 84.1K 32s
  1950K .......... .......... .......... .......... .......... 28%  297K 32s
  2000K .......... .......... .......... .......... .......... 29% 83.4K 32s
  2050K .......... .......... .......... .......... .......... 30%  298K 31s
  2100K .......... .......... .......... .......... .......... 31% 89.8K 31s
  2150K .......... .......... .......... .......... .......... 31%  238K 31s
  2200K .......... .......... .......... .......... .......... 32%  297K 30s
  2250K .......... .......... .......... .......... .......... 33% 84.0K 30s
  2300K .......... .......... .......... .......... .......... 34%  297K 30s
  2350K .......... .......... .......... .......... .......... 34%  149K 29s
  2400K .......... .......... .......... .......... .......... 35% 89.9K 30s
  2450K .......... .......... .......... .......... .......... 36%  238K 29s
  2500K .......... .......... .......... .......... .......... 36% 82.5K 29s
  2550K .......... .......... .......... .......... .......... 37%  298K 29s
  2600K .......... .......... .......... .......... .......... 38%  198K 28s
  2650K .......... .......... .......... .......... .......... 39% 73.6K 28s
  2700K .......... .......... .......... .......... .......... 39%  238K 28s
  2750K .......... .......... .......... .......... .......... 40%  297K 27s
  2800K .......... .......... .......... .......... .......... 41% 82.5K 27s
  2850K .......... .......... .......... .......... .......... 41%  297K 27s
  2900K .......... .......... .......... .......... .......... 42% 88.0K 27s
  2950K .......... .......... .......... .......... .......... 43%  298K 26s
  3000K .......... .......... .......... .......... .......... 44% 84.0K 26s
  3050K .......... .......... .......... .......... .......... 44%  298K 26s
  3100K .......... .......... .......... .......... .......... 45% 88.0K 25s
  3150K .......... .......... .......... .......... .......... 46%  297K 25s
  3200K .......... .......... .......... .......... .......... 47% 89.6K 25s
  3250K .......... .......... .......... .......... .......... 47%  238K 24s
  3300K .......... .......... .......... .......... .......... 48%  297K 24s
  3350K .......... .......... .......... .......... .......... 49% 82.0K 24s
  3400K .......... .......... .......... .......... .......... 49%  297K 23s
  3450K .......... .......... .......... .......... .......... 50% 84.2K 23s
  3500K .......... .......... .......... .......... .......... 51%  296K 23s
  3550K .......... .......... .......... .......... .......... 52% 72.0K 23s
  3600K .......... .......... .......... .......... .......... 52%  297K 22s
  3650K .......... .......... .......... .......... .......... 53%  298K 22s
  3700K .......... .......... .......... .......... .......... 54% 82.5K 22s
  3750K .......... .......... .......... .......... .......... 55%  238K 21s
  3800K .......... .......... .......... .......... .......... 55% 90.4K 21s
  3850K .......... .......... .......... .......... .......... 56%  238K 21s
  3900K .......... .......... .......... .......... .......... 57%  397K 20s
  3950K .......... .......... .......... .......... .......... 57% 83.4K 20s
  4000K .......... .......... .......... .......... .......... 58%  297K 19s
  4050K .......... .......... .......... .......... .......... 59% 84.2K 19s
  4100K .......... .......... .......... .......... .......... 60%  396K 19s
  4150K .......... .......... .......... .......... .......... 60% 82.5K 19s
  4200K .......... .......... .......... .......... .......... 61%  238K 18s
  4250K .......... .......... .......... .......... .......... 62% 89.7K 18s
  4300K .......... .......... .......... .......... .......... 62%  297K 18s
  4350K .......... .......... .......... .......... .......... 63% 82.9K 17s
  4400K .......... .......... .......... .......... .......... 64%  297K 17s
  4450K .......... .......... .......... .......... .......... 65% 83.9K 17s
  4500K .......... .......... .......... .......... .......... 65%  297K 16s
  4550K .......... .......... .......... .......... .......... 66% 90.4K 16s
  4600K .......... .......... .......... .......... .......... 67%  297K 16s
  4650K .......... .......... .......... .......... .......... 68%  297K 15s
  4700K .......... .......... .......... .......... .......... 68% 76.6K 15s
  4750K .......... .......... .......... .......... .......... 69%  298K 14s
  4800K .......... .......... .......... .......... .......... 70% 82.0K 14s
  4850K .......... .......... .......... .......... .......... 70%  238K 14s
  4900K .......... .......... .......... .......... .......... 71%  297K 13s
  4950K .......... .......... .......... .......... .......... 72% 84.0K 13s
  5000K .......... .......... .......... .......... .......... 73%  297K 13s
  5050K .......... .......... .......... .......... .......... 73% 83.3K 13s
  5100K .......... .......... .......... .......... .......... 74%  297K 12s
  5150K .......... .......... .......... .......... .......... 75% 90.5K 12s
  5200K .......... .......... .......... .......... .......... 76%  238K 11s
  5250K .......... .......... .......... .......... .......... 76% 90.5K 11s
  5300K .......... .......... .......... .......... .......... 77%  238K 11s
  5350K .......... .......... .......... .......... .......... 78%  297K 10s
  5400K .......... .......... .......... .......... .......... 78% 62.9K 10s
  5450K .......... .......... .......... .......... .......... 79%  297K 10s
  5500K .......... .......... .......... .......... .......... 80%  297K 9s
  5550K .......... .......... .......... .......... .......... 81% 83.9K 9s
  5600K .......... .......... .......... .......... .......... 81%  298K 9s
  5650K .......... .......... .......... .......... .......... 82% 83.2K 8s
  5700K .......... .......... .......... .......... .......... 83%  397K 8s
  5750K .......... .......... .......... .......... .......... 83% 82.0K 8s
  5800K .......... .......... .......... .......... .......... 84%  297K 7s
  5850K .......... .......... .......... .......... .......... 85%  297K 7s
  5900K .......... .......... .......... .......... .......... 86% 83.1K 7s
  5950K .......... .......... .......... .......... .......... 86%  105K 6s
  6000K .......... .......... .......... .......... .......... 87%  198K 6s
  6050K .......... .......... .......... .......... .......... 88%  238K 6s
  6100K .......... .......... .......... .......... .......... 89% 89.5K 5s
  6150K .......... .......... .......... .......... .......... 89%  297K 5s
  6200K .......... .......... .......... .......... .......... 90% 83.4K 5s
  6250K .......... .......... .......... .......... .......... 91%  238K 4s
  6300K .......... .......... .......... .......... .......... 91% 90.5K 4s
  6350K .......... .......... .......... .......... .......... 92%  238K 4s
  6400K .......... .......... .......... .......... .......... 93%  297K 3s
  6450K .......... .......... .......... .......... .......... 94% 82.6K 3s
  6500K .......... .......... .......... .......... .......... 94%  297K 2s
  6550K .......... .......... .......... .......... .......... 95% 83.7K 2s
  6600K .......... .......... .......... .......... .......... 96%  396K 2s
  6650K .......... .......... .......... .......... .......... 97% 83.3K 1s
  6700K .......... .......... .......... .......... .......... 97%  297K 1s
  6750K .......... .......... .......... .......... .......... 98% 88.5K 1s
  6800K .......... .......... .......... .......... .......... 99%  238K 0s
  6850K .......... .......... .......... .......... .......... 99%  297K 0s
  6900K ......                                                100%  108M=48s

2022-06-07 05:56:42 (144 KB/s) - '/root/server_demo' saved [7072648/7072648]

--2022-06-07 05:56:42--  http://host.httap.com:8001/images/demo/conf.toml
Resolving host.httap.com (host.httap.com)... 139.196.94.34
Connecting to host.httap.com (host.httap.com)|139.196.94.34|:8001... connected.
HTTP request sent, awaiting response... 200 OK
Length: 94 [text/plain]
Saving to: '/root/conf.toml'

     0K                                                       100% 15.1M=0s

2022-06-07 05:56:42 (15.1 MB/s) - '/root/conf.toml' saved [94/94]

Removing intermediate container a9d7f740a4ef
 ---> ae28259b4944
Step 3/4 : EXPOSE 7777
 ---> Running in fc23e45ee07c
Removing intermediate container fc23e45ee07c
 ---> e800cbfc7876
Step 4/4 : CMD cd /root &&/root/server_demo
 ---> Running in 7d2ee8232c4f
Removing intermediate container 7d2ee8232c4f
 ---> 00922e80b919
Successfully built 00922e80b919
Successfully tagged test:latest
[ec2-user@ip-10-0-0-134 ~]$ docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[ec2-user@ip-10-0-0-134 ~]$ docker run --privileged=true -itd -p 8001:7777 test
222af14efcd2c4880de4e84f3addc8c81ae4446e0c09ca890d92e25af66e0ff9
[ec2-user@ip-10-0-0-134 ~]$ docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                                       NAMES
222af14efcd2   test      "/bin/sh -c 'cd /roo…"   3 seconds ago   Up 2 seconds   0.0.0.0:8001->7777/tcp, :::8001->7777/tcp   tender_merkle
[ec2-user@ip-10-0-0-134 ~]$ curl localhost:8001
Hello World[ec2-user@ip-10-0-0-134 ~]$

 

FROM amazonlinux:latest

RUN yum install -y wget  && 
wget http://host.httap.com:8001/images/demo/server_demo -O /root/server_demo && 
wget http://host.httap.com:8001/images/demo/conf.toml  -O /root/conf.toml && 
chmod a+x /root/server_demo

EXPOSE 7777

CMD cd /root &&
/root/server_demo

 

程序员灯塔
转载请注明原文链接:docker build
喜欢 (0)