docker镜像创建
1. 首选要创建一个Dockerfile文件,内容如下:
FROM alpine:latest
MAINTAINER lobin <lobin.hotmail.com>
RUN apk add --no-cache --update-cache bash
CMD ["/bin/bash"]
2. 生成镜像,取名apline-bash
[root@VM_0_13_centos demo]# docker build -t apline-bash .
Sending build context to Docker daemon 2.048 kB
Step 1/4 : FROM alpine:latest
---> 3fd9065eaf02
Step 2/4 : MAINTAINER lobin <lobin.hotmail.com>
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in a73f8500b494
---> 398e9ed5537e
Removing intermediate container a73f8500b494
Step 3/4 : RUN apk add --no-cache --update-cache bash
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in dd629be23601
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/main: temporary error (try again later)
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/community: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
bash (missing):
required by: world[bash]
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
The command '/bin/sh -c apk add --no-cache --update-cache bash' returned a non-zero code: 1
3. 出现以上错误,没辙,重启docker能解决,但问题不知道
[root@VM_0_13_centos demo]# systemctl restart docker
4. 重新构建镜像
[root@VM_0_13_centos demo]# docker build -t apline-bash .
Sending build context to Docker daemon 2.048 kB
Step 1/4 : FROM alpine:latest
---> 3fd9065eaf02
Step 2/4 : MAINTAINER lobin <lobin.hotmail.com>
---> Using cache
---> 398e9ed5537e
Step 3/4 : RUN apk add --no-cache --update-cache bash
---> Running in 4ce990201bfd
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/6) Installing pkgconf (1.3.10-r0)
(2/6) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(3/6) Installing ncurses-terminfo (6.0_p20171125-r0)
(4/6) Installing ncurses-libs (6.0_p20171125-r0)
(5/6) Installing readline (7.0.003-r0)
(6/6) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
Executing busybox-1.27.2-r7.trigger
OK: 13 MiB in 17 packages
---> b6ed2497fc7e
Removing intermediate container 4ce990201bfd
Step 4/4 : CMD /bin/bash
---> Running in 61323661705d
---> a7414979d240
Removing intermediate container 61323661705d
Successfully built a7414979d240
[root@VM_0_13_centos demo]#
Message from syslogd@localhost at Jul 4 23:49:17 ...
kernel:unregister_netdevice: waiting for lo to become free. Usage count = 1
Message from syslogd@localhost at Jul 4 23:49:27 ...
kernel:unregister_netdevice: waiting for lo to become free. Usage count = 1
5. 查看镜像,好小呀
[root@VM_0_13_centos demo]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
apline-bash latest a7414979d240 8 minutes ago 9.5 MB
docker.io/redis latest 71a81cb279e3 7 days ago 83.4 MB
docker.io/mysql latest 8d99edb9fd40 7 days ago 445 MB
docker.io/alpine latest 3fd9065eaf02 5 months ago 4.15 MB
docker镜像创建的更多相关文章
- docker镜像创建redis5.0.3容器集群
拉取redis5.0.3镜像 # docker pull daocloud.io/library/redis:5.0.3 [root@localhost ~]# docker pull daoclou ...
- docker 镜像创建
dockerfile FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE COPY ${source:-/} . ENTRYPOI ...
- 基于空镜像scratch创建一个新的Docker镜像
我们在使用Dockerfile构建docker镜像时,一种方式是使用官方预先配置好的容器镜像.优点是我们不用从头开始构建,节省了很多工作量,但付出的代价是需要下载很大的镜像包. 比如我机器上docke ...
- Docker 镜像编排并部署SpringBoot应用
Docker-compose是一个基于Docker的编排工具,所谓编排个人理解就是将不同的镜像通过配置,组成一个新的运行环境,官方定义是:Compose is a tool for defining ...
- Docker镜像、容器剖析
我们通常所说的docker是什么? 在这里英文本意为“搬运工”这里指的的docker搬运点的是集装箱,集装箱装的是够任意类型的APP,开发者通过Docker可以将app变成一种标准化,可移植的.自管理 ...
- 简单谈谈Docker镜像的使用方法_docker
在上篇文章(在Docker中搭建Nginx服务器)中,我们已经介绍了如何快速地搭建一个实用的Nginx服务器.这次我们将围绕Docker镜像(Docker Image),介绍其使用方法.包括三部分: ...
- SequoiaDB 巨杉数据库Docker镜像使用教程
为方便用户快速体验,SequoiaDB 巨杉数据库提供基于 Docker 的镜像.本文介绍如何在 Docker 环境下部署 SequoiaDB 分布式集群环境. 集群规划 我们准备在五个容器中部署 ...
- 傲视Kubernetes(二):Docker镜像搭建与本地Kubernetes环境搭建
主要内容: 1.Docker与Kubernetes的关系 2.SpringBoot微服务的Docker镜像创建 3.Kubernetes本地环境搭建 一.Docker与Kubernetes的关系 在说 ...
- docker学习之二镜像创建
继上一篇docker入门之后写一点使用的经验. 通过命令:docker run -it REPOSITORY或IMAGE ID 注:-it后面跟的字段可以通过下面指令获得 创建运行的容器,会进入一 ...
随机推荐
- java: new Date().getTime() 与 System.currentTimeMillis() 与 System.nanoTime()
java使用new Date()和System.currentTimeMillis()获取当前时间戳 在开发过程中,通常很多人都习惯使用new Date()来获取当前时间,使用起来也比较方便,同时 ...
- 使用.net实现ZooKeeper客户端
最近在项目中用到ZooKeeper, 通过Java连接比较容易,.net项目就没那么容易,尤其对于不熟悉Linux的开发人员,这里写点搭建ZooKeeper测试环境的经验,供参考. 背景知识: Zoo ...
- Ubuntu 16.04上编译SkyEye的测试程序
一.首先确保Ubuntu系统上已经安装了Skyeye.skyeye-testsuite和arm-linux-gcc交叉编译工具链,如果没有安装请参考: 1.Skyeye的安装:http://www.c ...
- BZOJ-4819: 新生舞会(01分数规划+费用流)
Description 学校组织了一次新生舞会,Cathy作为经验丰富的老学姐,负责为同学们安排舞伴.有n个男生和n个女生参加舞会 买一个男生和一个女生一起跳舞,互为舞伴.Cathy收集了这些同学之间 ...
- 远程调用appium server
例如:我有两台电脑A(192.168.112.10)和B(192.168.112.11),那我怎么能在A执行本地脚本,但是使用B上的server呢? 查看appium连接appium服务并开启一个 ...
- 「LuoguP2365」 任务安排(dp
题目描述 N个任务排成一个序列在一台机器上等待完成(顺序不得改变),这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务单独完成所需的时间是Ti. 在每批任务开 ...
- javacpp-FFmpeg系列之2:通用拉流解码器,支持视频拉流解码并转换为YUV、BGR24或RGB24等图像像素数据
javacpp-ffmpeg系列: javacpp-FFmpeg系列之1:视频拉流解码成YUVJ420P,并保存为jpg图片 javacpp-FFmpeg系列之2:通用拉流解码器,支持视频拉流解码并转 ...
- Python文件运行时报TabError: inconsistent use of tabs and spaces in indentation
1. 问题描述 Python文件运行时报TabError: inconsistent use of tabs and spaces in indentation 2. 问题原因 tab 和 space ...
- 01_SQlite数据库简介
- Brute-Force-Attack on Triple-DES with Reduced Key Space
题目地址:https://www.mysterytwisterc3.org/en/challenges/level-ii/brute-force-attack-on-triple-des-with-r ...