首页 文章 精选 留言 我的

精选列表

搜索[小程序·云开发],共10036篇文章
优秀的个人博客,低调大师

Docker 上传镜像&拉取镜像

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36367789/article/details/81623850 与git相似,docker也有自己的镜像仓库,官方仓库网站是https://hub.docker.com/,其实我们平时docker pull xxx就是从该仓库得到的镜像(在不设置国内镜像加速的情况下)。它和git仓库很相似。 创建账号 DockerHub:https://hub.docker.com/ 很多人在这里就出了问题,为什么都填完了但是不能点注册按钮呢?因为该网站目前来说注册是需要翻墙的,注册成功后再关闭翻墙。 我重新上传一个项目做示范,该镜像是从hub上pull到的一个nginx镜像,我把它上传到我的公开仓库。 上传镜像 先登录docker hub账号。 docker login [root@FantJ ~]# 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 (fantj): fantj Password: Login Succeeded [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]# docker tag docker.io/nginx fantj/nginx [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB fantj/nginx latest ae513a47849c 4 weeks ago 109 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]# docker push fantj/nginx The push refers to a repository [docker.io/fantj/nginx] 7ab428981537: Mounted from library/nginx 82b81d779f83: Mounted from library/nginx d626a8ad97a1: Mounted from library/nginx latest: digest: sha256:e4f0474a75c510f40b37b6b7dc2516241ffa8bde5a442bde3d372c9519c84d90 size: 948 [root@FantJ ~]# 流程大概是:登录->tag操作->push 注:tag 的第二个参数的前缀是你的hub账户名 拉取镜像 我先把服务器上的镜像删除掉,然后再从hub中拉取镜像。 # 删除本地fantj/nginx镜像 [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB fantj/nginx latest ae513a47849c 4 weeks ago 109 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]# docker rmi fantj/nginx Untagged: fantj/nginx:latest Untagged: fantj/nginx@sha256:e4f0474a75c510f40b37b6b7dc2516241ffa8bde5a442bde3d372c9519c84d90 [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB # 从hub中拉取fantj/nginx镜像 [root@FantJ ~]# docker pull fantj/nginx Using default tag: latest Trying to pull repository docker.io/fantj/nginx ... latest: Pulling from docker.io/fantj/nginx Digest: sha256:e4f0474a75c510f40b37b6b7dc2516241ffa8bde5a442bde3d372c9519c84d90 Status: Downloaded newer image for docker.io/fantj/nginx:latest [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB docker.io/fantj/nginx latest ae513a47849c 4 weeks ago 109 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]#

优秀的个人博客,低调大师

Java Web && PHP 对比——嵌入篇

Java Web学习笔记——同时与PHP对比 博主在在学习Java Web,因为之前有学习过PHP,感觉二者有相似之处也有不同之处。所以在学习Java Web过程中,总结一下,希望能有所收获。 1、JSP的java代码嵌入和PHP文件中的PHP代码嵌入。(二者必须是Jsp文件或PHP文件才能实现嵌入html元素) 1.1JSP: //for循环输出表单 <% for ($i=0; $i < 5 ; $i++) { //for循环 %> <tr> <td>张三</td> <td>29</td> </tr> <% } //for循环结束 %> 1.2PHP: //for循环输出表单 <?php for ($i=0; $i < 5 ; $i++) { //for循环 ?> <tr> <td>张三</td> <td>29</td> </tr> <?php } //for循环结束 ?> 输出

优秀的个人博客,低调大师

Java Web &amp;&amp; PHP 对比——Cookie篇

Java Web学习笔记——同时与PHP对比 博主在在学习Java Web,因为之前有学习过PHP,感觉二者有相似之处也有不同之处。所以在学习Java Web过程中,总结一下,希望能有所收获。 2、JSP和PHP的Cookie设置和获取 2.1JSP: <% //设置cookie Cookie name = new Cookie("name","JSP"); // 设置cookie过期时间为1小时。 name.setMaxAge(60*60); // 在响应头部添加cookie response.addCookie( name ); //获取Cookie Cookie[] cookies =request.getCookies(); if( cookies != null ){ for (int i = 0; i < cookies.length; i++){ cookie = cookies[i]; out.print(cookie.getName());+":"+cookie.getValue()+"</br>"); } %> 2.2PHP: <?php setcookie("user", "PHP", time()+3600); //设置cookie echo $_COOKIE["user"]; // 输出 cookie 值 ?>

优秀的个人博客,低调大师

Android LruCache &amp;amp; DiskLruCache cooperate working in ListView

package zhangphil.cache; import android.app.ListActivity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.os.Bundle; import android.util.Log; import android.util.LruCache; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.security.MessageDigest; public class MainActivity extends ListActivity { private LruCache<String, Bitmap> mLruCache; private DiskLruCache mDiskLruCache; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int CACHE_SIZE = 8 * 1024 * 1024; mLruCache = new LruCache(CACHE_SIZE); try { mDiskLruCache = DiskLruCache.open(this.getCacheDir(), 1, 1, CACHE_SIZE * 10); } catch (Exception e) { e.printStackTrace(); } ArrayAdapter mAdapter = new ArrayAdapter(this, 0) { @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { ImageView image = new ImageView(getContext()); load(R.mipmap.ic_launcher, image); return image; } @Override public int getCount() { return 20; } }; setListAdapter(mAdapter); } private void load(int id, ImageView image) { String key = null; if (id == R.mipmap.ic_launcher) { key = getMD5("R.mipmap.ic_launcher"); } //首先查找LruCache中的缓存 Bitmap bmp = mLruCache.get(key); if (bmp == null) { Log.d("LruCache缓存", "没有,继续深入到DiskLruCache读取。"); bmp = readFromDiskLruCache(key); if (bmp == null) { Log.d("LruCache与DiskLruCache", "没有缓存,开始创建新数据资源并缓存之。"); bmp = BitmapFactory.decodeResource(getResources(), id); //初次创建新资源,更新到DiskLruCache writeToDiskLruCache(key, bmp); } else { image.setImageBitmap(bmp); } //更新到LruCache缓存中,以待下一次使用。 mLruCache.put(key, bmp); Log.d("LruCache缓存", "写入完成。"); } else { //命中缓存 Log.d("LruCache缓存", "已有,复用。"); image.setImageBitmap(bmp); } } private void writeToDiskLruCache(String key, Bitmap bmp) { try { DiskLruCache.Editor editor = mDiskLruCache.edit(key); //把Bitmap转化为byte数组存储 ByteArrayOutputStream baos = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] bytes = baos.toByteArray(); //再次把Bitmap数组写进为DiskLruCache准备的输出流。 OutputStream os = editor.newOutputStream(0); os.write(bytes); os.flush(); //正式写入DiskLruCache editor.commit(); Log.d("DiskLruCache缓存", "写入缓存资源完毕。"); } catch (Exception e) { e.printStackTrace(); } } private Bitmap readFromDiskLruCache(String key) { DiskLruCache.Snapshot snapShot = null; try { snapShot = mDiskLruCache.get(key); } catch (Exception e) { e.printStackTrace(); } Bitmap bmp = null; if (snapShot != null) { Log.d("DiskLruCache缓存", "发现资源,复用。"); InputStream is = snapShot.getInputStream(0); bmp = BitmapFactory.decodeStream(is); } else { Log.d("DiskLruCache缓存", "没有发现缓存资源。"); } return bmp; } private String getMD5(String msg) { MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (Exception e) { e.printStackTrace(); } md.reset(); md.update(msg.getBytes()); byte[] bytes = md.digest(); String result = ""; for (byte b : bytes) { result += String.format("%02x", b); } return result; } }

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册