dockerfile创建镜像1
vim Dockerfile
FROM alpine:latest
MAINTAINER brady
CMD echo "hello world"
进行构建
docker build -t hello_docker .
[root@localhost dnmp_test]# ls
[root@localhost dnmp_test]# vim Dockerfile
[root@localhost dnmp_test]# docker build -t hello_docker .
Sending build context to Docker daemon 2.048 kB
Step / : FROM alpine:latest
Trying to pull repository docker.io/library/alpine ...
latest: Pulling from docker.io/library/alpine
9d48c3bd43c5: Pull complete
Digest: sha256:72c42ed48c3a2db31b7dafe17d275b634664a708d901ec9fd57b1529280f01fb
Status: Downloaded newer image for docker.io/alpine:latest
--->
Step / : MAINTAINER brady ▽
---> Running in f1802f56a693
---> 00cdf7104f8b
Removing intermediate container f1802f56a693
Step / : CMD echo "hello world"
---> Running in e7b7a18d8c32
---> baa4664fe58d
Removing intermediate container e7b7a18d8c32
Successfully built baa4664fe58d
[root@localhost dnmp_test]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello_docker latest baa4664fe58d seconds ago 5.58 MB
nginx-fun latest 6ea0e8bb024d minutes ago MB
docker.io/nginx latest ab56bba91343 days ago MB
docker.io/alpine latest weeks ago 5.58 MB
[root@localhost dnmp_test]# docker run hello_docker
hello world
推送到远程
[root@localhost docker]# ls
Dockerfile
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello_docker latest c4ea4dd5f8f9 2 minutes ago 5.59MB
alpine latest e7d92cdc71fe 5 weeks ago 5.59MB
[root@localhost docker]# docker commit -a brady -m "hello docker" c4ea4dd5f8f9 yeves/hello_docker
Error response from daemon: No such container: c4ea4dd5f8f9
[root@localhost docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59d586c17da1 hello_docker "/bin/sh -c 'echo \"h…" 2 minutes ago Exited (0) 2 minutes ago musing_shamir
9b8fe3409f62 hello_docker "/bin/sh -c 'echo \"h…" 2 minutes ago Exited (0) 2 minutes ago festive_nightingale
[root@localhost docker]# docker commit -a brady -m "hello docker" 59d586c17da1 yeves/hello_docker
sha256:315c59b50d02e0617d9249300f0f2f54fb929d4dcda124e71a07c87864455bcc
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
yeves/hello_docker latest 315c59b50d02 6 seconds ago 5.59MB
hello_docker latest c4ea4dd5f8f9 3 minutes ago 5.59MB
alpine latest e7d92cdc71fe 5 weeks ago 5.59MB
[root@localhost docker]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: yeves
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
yeves/hello_docker latest 315c59b50d02 49 seconds ago 5.59MB
hello_docker latest c4ea4dd5f8f9 4 minutes ago 5.59MB
alpine latest e7d92cdc71fe 5 weeks ago 5.59MB
[root@localhost docker]# docker tag 315c59b50d02 yeves/hellow_docker:v1.0
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
yeves/hello_docker latest 315c59b50d02 About a minute ago 5.59MB
yeves/hellow_docker v1.0 315c59b50d02 About a minute ago 5.59MB
hello_docker latest c4ea4dd5f8f9 4 minutes ago 5.59MB
alpine latest e7d92cdc71fe 5 weeks ago 5.59MB
[root@localhost docker]# docker push yeves/hello_docker:v1.0
The push refers to repository [docker.io/yeves/hello_docker]
tag does not exist: yeves/hello_docker:v1.0
[root@localhost docker]#
dockerfile创建镜像1的更多相关文章
- docker——Dockerfile创建镜像
写在前面: 继续docker的学习,昨天用docker成功跑了tomcat,但是在centos中镜像跑的容器手动装jdk和tomcat,今天学习用Dockerfile创建镜像,并在上面搭建java环境 ...
- Dockerfile创建镜像
Dockerfile是一个文本格式的配置文件,用户可以使用Dockerfile来快速创建自定义的镜像. Dockerfile由一行行命令语句组成,并且支持易#开头的注释行. 一般而言Dockerfil ...
- docker常用命令、镜像命令、容器命令、数据卷,使用dockerFile创建镜像,dockefile的语法规则。
一.docker常用命令? 1. 常用帮助命令 1.1 docker的信息以及版本号 /* docker info 查看docker的信息 images2 docker本身就是一个镜像. docker ...
- 如何用Dockerfile创建镜像
本文原创,原文地址为:http://www.cnblogs.com/fengzheng/p/5181222.html 创建镜像的目的 首先说DockerHub或其它一些镜像仓库已经提供了够多的镜像,有 ...
- docker学习笔记6:利用dockerfile创建镜像介绍(生成简单web服务器镜像)
本文介绍如何利用dockerfile来创建镜像.下面介绍具体的操作过程: 一.创建构建环境 操作示例如下: xxx@ubuntu:~$ pwd /home/xxx xxx@ubuntu:~$ mkdi ...
- 使用Dockerfile创建镜像
Dockerfile是一个文本格式的配置文件,用户可以使用Dockerfile来快速创建自定义的镜像. 一.基本结构 Dockerfile由一行行命令语句组成,并且支持以#开头的注释行. 一般而言,D ...
- [转]Docker基础-使用Dockerfile创建镜像
本文转自:https://www.cnblogs.com/jie-fang/p/7927643.html 1.基本结构 Dockerfile由一行行命令语句组成,并支持以#开头的注释行.例如: # T ...
- Docker基础-使用Dockerfile创建镜像
1.基本结构 Dockerfile由一行行命令语句组成,并支持以#开头的注释行.例如: # This dockerfile uses the ubuntu image # VERSION 2 - ED ...
- Docker学习笔记之通过 Dockerfile 创建镜像
0x00 概述 由于 Docker 镜像的结构优势,使它的占用空间远小于普通的虚拟机镜像,而这就大幅减少了 Docker 镜像在网络或者其他介质中转移所花费的时间,进而提高了我们进行迁移部署的效率.不 ...
- docker Dockerfile 创建镜像
Docker 组件 1. docker client : docker的客户端 2. docker server : docker daemon的主要组成部分,接受用户通过docker client发 ...
随机推荐
- Win10+Ubuntu18.04安装双系统
一:相关资料 (一)Win10+Ubuntu18.04 亲测UEFI启动模式双硬盘+双系统成功安装经验(文章) (二)如何安装Linux与windows双系统?(视频) 推荐先看视频,之后按照文章进行 ...
- Linux记录-SVN+Jenkins+jdk+maven自动化集成部署
1.svn部署 yum -y install subversion svnserve --version 查看版本 mkdir -p /usr/app/svn svnadmin create /usr ...
- 【443】Tweets Analysis Q&A
[Question 01] When converting Tweets info to csv file, commas in the middle of data (i.e. locati ...
- PP篇9 更改计划订单
首先看了下这个函数的版本 还挺新的 S4版本应该是有更新过,里面用了新语法 导入: PLANNEDORDER 计划订单号HEADERDATA 表头数据(来自外部系统) HEA ...
- 机器学习中的数学-线性判别分析(LDA)
前言在之前的一篇博客机器学习中的数学(7)——PCA的数学原理中深入讲解了,PCA的数学原理.谈到PCA就不得不谈LDA,他们就像是一对孪生兄弟,总是被人们放在一起学习,比较.这这篇博客中我们就来谈谈 ...
- Cas(03)——Cas Server中各配置文件介绍
Cas Server中各配置文件介绍 Cas Server中所有的配置文件都是放在WEB-INF目录及其子目录下的. 在WEB-INF/classes下的配置文件有: l cas-theme-def ...
- 开发环境下的 Kubernetes 容器网络演进之路
马蜂窝技术原创文章,更多干货请搜索公众号:mfwtech 使用 Docker+Kubernetes 来简化开发人员的工作流,使应用更加快速地迭代,缩短发布周期,在很多研发团队中已经是常见的做法. 如果 ...
- [转帖]Java 2019 生态圈使用报告,这结果你赞同吗?
Java 2019 生态圈使用报告,这结果你赞同吗? http://www.51testing.com/html/94/n-4462794.html 发表于:2019-10-15 17:10 作者: ...
- Java串口通信 RXTX 解决过程
背景介绍: 由于第一次用Java与硬件通信,网上查了许多资料,在这进行整理,便于以后学习.本人串口测试是USB串口设备连接电脑,在设备管理器中找到端口名称(也可以通过一些虚拟串口工具模拟). 下面主要 ...
- 列主元消去法&全主元消去法——Java实现
Gauss.java package Gauss; /** * @description TODO 父类,包含高斯列主元消去法和全主元消去法的共有属性和方法 * @author PengHao * @ ...