Docker 使用 alpine 构建镜像时出现添加的可执行文件无法使用的问题

使用Alpine镜像构建镜像 一、alpine介绍 1、Alpine Linux是一个完整的操作系统,像其他操作系统一样,可以将Alpine安装到本地硬盘中,使用apk进行包管理。 包含了以下特点: 小巧:基于Musl libc和busybox,和busybox一样小巧,最小的Docker镜像只有5MB; 安全:面向安全的轻量发行版; 简单:提供APK包管理工具,软件的搜索、安装、删除、升级都非常方便。 适合容器使用:由... 阅读详情

Docker 使用 alpine 构建镜像时出现添加的可执行文件无法使用的问题

问题起因

笔者今天第一次使用 alpine 作为 docker 的基础镜像,只知道 alpine 是一个极其精简的 Linux 版本,没有更多地去了解。笔者像平时一样用 g++ 编译程序,在本地运行时正常,但在 Dockerfile 中使用 COPY 命令添加后,却出现了无法运行的问题,具体体现为:

$ docker run mazeprog:latest 
/bin/sh: /opt/maze: not found

对应的 Dockerfile 为:

From alpine:latest
COPY ./maze /opt/
COPY ./m2 /opt
RUN chmod 0777 /opt/maze
CMD /opt/maze /opt/m2

其中,maze 是一个 x86_64 的可执行 ELF 文件,m2 是一个主程序使用的文本文件。

解决思路

出现了 not found 的问题后,立刻想到两个可能的原因,可以试着先排查一下。
首先是,是否正确地放置到了预期的位置?这个通过基于构建的镜像运行一下 ls 命令就可以知道:

$ docker run mazeprog ls /opt -l 
total 28
-rw-r--r--    1 root     root           641 Apr 11 14:01 m2
-rwxrwxrwx    1 ro
docker创建Alpine镜像 1. 什么是Alpine Alpine Linux 是一个社区开发的面向安全应用的轻量级Linux发行版,适合用来做Docker镜像、路由器、防火墙、VPNs、VoIP 盒子 以及服务器的操作系统,基于musl libc和Busybox,镜像大小只有5M,并且还提供了包管理工具apk查询和安装软件包。 2. 获取Alpine镜像 docker search Alpine $ dock... 阅读详情

相关推荐

解决Docker构建中Alpine镜像源超时问题的实战指南

本文针对Docker构建Alpine镜像时常见的“fetch APKINDEX.tar.gz”超时问题,提供了详细的实战解决方案。核心思路是通过正确覆盖/etc/apk/repositories文件,将官方海外源替换为阿里云等国内镜像源,并对比了正确覆盖与错误追加方法的差异,从根本上解决因网络延迟导致的构建卡顿和失败。

sprite的博客 1064

docker alpine镜像中遇到 sh: xxx: not found

如题,在docker-compose 编排Go应用的时候alphine容器出现可执行文件不存在的问题。 猜测: 一:难道文件在容器中没有执行权限? 针对这个操作,我在command命令中加入了chmod 700 运行结果:not found … 二:由于可执行文件是通过volume映射过去的,莫非哪里出了问题导致容器中不存在该文件? 为了验证上面的想法于是在command命令中加上了ls -l,运行结果显示是存在该文件的。 三:莫非是alphine的问题?? 于是我直接将整个alphine镜像换成的gola

记事本 8756

【硬件工程师职业细分】揭秘硬件基带工程师

你知道硬件工程师的细分领域硬件基带工程师吗? 它们和常见的硬件工程师又有哪些不同? 福利待遇怎么样?有哪些职业要求? 快来涨上一波知识吧~

woshizzai的博客 1万+

【Godot】构建可维护的游戏工程 —— 项目代码组织结构

本文系统梳理了Godot引擎项目组织原则与架构模式,提出场景中心化、命名规范一致性和资源隔离三大核心原则。推荐按功能模块划分目录结构(如scenes/、entities/、systems/),采用snake_case命名避免跨平台问题,并通过.gdignore优化资源管理。文章详细解析了自包含场景设计、信号驱动解耦等架构技巧,以及团队协作中的版本控制策略,强调通过模块化设计平衡一致性与实用性。最终目标构建清晰可维护的项目结构,使资源定位和功能扩展更加高效。(148字)

qq_40205510的博客 1174

QoderWake 与 Qoder 工具生态详解

Qoder CLIQoder SDKQoderWake谁在用你(开发者)你的程序你的数字员工谁在跑你的终端会话你的应用进程Daemon 后台进程什么时候跑你启动时你的代码调用时7×24 持续运行怎么触发键盘输入函数调用定时/事件/API/IM有记忆吗会话级 + 文件无多层持久记忆能协作吗Subagent多 Waker + IM 群组核心价值编码效率集成灵活性自主生产力一句话总结。

驽马不舍 950

stm32f407VET6 系统学习 day01 GPIO 配置

stm32f407VET6 系统学习 day01 GPIO 配置 LED 蜂鸣器 按键的不讲了,之前讲过了

she666666的博客 8904

Revit二次开发——不启动Revit,做rvt文件数据导出

Revit二次开发——不启动Revit,做rvt文件数据导出Node.js部分调用C#端供外部调用的dllC#部分调用RevitNet.dll,做数据导出exe做外部调用dll总结功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 N

Y.Jerome的专栏 4110

车载软件架构 —— AUTOSAR Vector SIP包(三)

### 上一篇文章中介绍了AUTOSAR基础软件供应商Vector公司的开发工具链,本文将继续介绍Vector公司的AUTOSAR产品。 ### -> 1、Vector SIP包中的StartApplication ### -> 2、StartApplication如何开始使用

Soly_kun的博客 828

把 ABAP 出站 IDoc 做到稳如老狗:从数据抽取到端口投递的全链路拆解

SAP出站IDoc创建流程解析 本文详细拆解了SAP系统中出站IDoc的创建流程,将其归纳为四个关键阶段:数据获取、数据转换、控制记录校验和端口投递。文章指出,IDoc的稳定性取决于整条流水线的设计质量,而不仅仅是字段映射。 核心要点包括: IDoc由控制记录和数据记录组成,需在WE31/WE30中定义段结构 2.数据获取阶段需明确触发点、依赖链和一致性保证 3.数据转换应遵循"结构版本+映射纪律"原则 4.控制记录校验决定IDoc能否发出,需与WE20伙伴配置匹配 5.端口类型(tRF

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 172

从0玩转Mamba神经网络:理论+实战的保姆级教程

Mamba神经网络是一种基于状态空间模型(SSM)的高效序列处理架构,相比Transformer具有更快的推理速度和更低的内存消耗。本文提供从理论到实践的完整指南,详细讲解Mamba的工作原理、与Transformer的差异,并给出基于PyTorch的文本分类实战示例。教程包含环境配置、数据处理、模型搭建、训练评估全流程,展示了Mamba在IMDb情感分析任务中的应用。文章还探讨了Mamba的性能优势及进阶方向,为开发者提供了探索这一新兴技术的实用指南。通过阅读本文,读者可以快速掌握Mamba的核心概念并上

FJN110的博客 316

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

上一篇: 在 Debian 上将 aria2c 封装为服务的方法及遇到的踩坑点
造轮使者
博客等级 码龄9年 30粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值