Ubuntu 20.04下用snap安装Docker的那些坑:为什么systemctl restart docker.service不工作?

systemVerilog中bind使用方法 代码】systemVerilog中bind使用方法。 阅读详情

Ubuntu 20.04下用snap安装Docker的那些坑:为什么systemctl restart docker.service不工作?

最近在Ubuntu 20.04上配置开发环境,为了图省事,直接用snap install docker一条命令装好了Docker。本以为万事大吉,结果在尝试重启Docker服务时,熟悉的sudo systemctl restart docker.service命令却给了我当头一棒——终端冷冰冰地提示“Unit file docker.service does not exist”。相信不少从其他Linux发行版转过来,或者习惯用apt安装Docker的朋友,都遇到过这个让人困惑的瞬间。这不仅仅是命令失效那么简单,它背后是Ubuntu近年来力推的Snap包管理体系与传统Systemd服务管理机制之间的一次“理念碰撞”。对于追求高效、稳定且需要精细控制服务的开发者而言,理解这背后的“为什么”以及掌握正确的“怎么做”,远比记住几个命令更有价值。本文将带你深入这个问题的核心,不仅解决服务管理问题,更厘清Snap与Systemd的协作关系,让你在Ubuntu上驾驭Docker时更加得心应手。

1. 问题根源:Snap与Systemd的“服务管理权”之争

当你在Ubuntu 20.04上通过Snap安装Docker后,系统里其实存在两套服务管理体系在同时运作。一套是你熟悉的、统治着绝大多数Linux发行版的Systemd,它通过.service单元文件来定义和管理后台守护进程(daemon)。另一套则是Canonical(Ubuntu背后的公司)大力推广的Snap打包体系自带的运行时管理环境。

Snap的设计哲学是提供一个高度封装、自包含且安全的软件分发方式。一个Snap包将其运行所需的所有依赖(包括特定的库、运行时环境)都打包在一起,形成一个独立的“沙盒”。为了实现这种隔离和自管理,Snap拥有自己的一套服务管理机制。当你执行snap install docker时,Snap系统不仅安装了Docker的二进制文件,还自动创建并注册了管理Docker守护进程(dockerd)所需的Snap服务。

注意:这里的“服务”指的是Snap语境下的服务,它是一个由snapd(Snap守护进程)管理的、在沙盒内运行的后台进程。它与Systemd管理的“系统服务”概念相似,但管理接口和生命周期完全独立。

因此,systemctl restart docker.service失败的根本原因在于:Systemd的单元文件目录(如/etc/systemd/system/或/lib/systemd/system/)中,根本不存在一个名为docker.service的文件。这个文件原本应由apt安装的Docker包提供。Snap安装的Docker,其服务定义被封装在Snap内部,由snapd直接管理。你可以通过以下命令验证这一点:

# 查找系统范围内是否存在docker.service单元文件
systemctl list-unit-files | grep docker

# 或者直接检查单元文件路径
ls /etc/systemd/system/docker.service 2>/dev/null || echo "文件不存在"
ls /lib/systemd/system/docker.service 2>/dev/null || echo "文件不存在"

执行后

Systemverilog中operators和expression的记录 本文记录了Systemverilog中operators和expression的一些知识点。 阅读详情

相关推荐

SystemVerilog bind用法详解:不止是断言,还能这样连接模块(附代码避坑)

本文深入解析SystemVerilog中bind关键字的多种应用场景,从基础的断言绑定到高级的模块连接技巧。通过实际代码示例展示如何利用bind实现非侵入式的功能扩展,包括监控逻辑添加、覆盖率收集和调试探针插入,同时提供信号映射避坑指南和工程实践建议,帮助硬件设计工程师提升验证效率。

weixin_42536058的博客 188

Ubuntu 20.04 安装配置 Docker 的完整实践指南

Docker 是一种基于 Linux 内核特性的容器化技术,其核心依赖 cgroups、namespaces、overlayfs 等底层机制。在 Ubuntu 20.04 这一广泛使用的 LTS 发行版上部署 Docker,不仅涉及标准安装流程,更需关注内核兼容性、安全模块(如 AppArmor)策略、systemd 服务管理及国内镜像加速等工程细节。正确配置可显著提升镜像拉取速度、容器启动稳定性与运行时安全性,适用于 CI/CD、AI 开发环境及云服务器部署等典型场景。本文聚焦 Ubuntu 20.04

weixin_30387423的博客 378

Ubuntu 20.04 安装 Jenkins 实操指南:避坑、Java 配置与 deb 包部署

Jenkins 是持续集成(CI)与持续交付(CD)的核心开源工具,其运行依赖稳定的 Java 运行时环境、系统服务管理机制及安全的软件源配置。在 Ubuntu 20.04 这一广泛使用的 LTS 系统中,因 OpenJDK 版本滞后、apt-key 弃用、systemd 集成要求高等原因,原生安装极易失败。本文从 Java 兼容性原理出发,解析 G1 垃圾回收参数适配、headless 模块缺失等底层技术问题;强调采用 Eclipse Temurin JDK 11 和 Jenkins 官方 Debian

weixin_33795093的博客 422

Ubuntu 20.04 安装 Docker Compose v2 的必要性与实操指南

Docker Compose 是容器化应用编排的核心工具,其 v2 版本采用 Go 语言重构,深度集成于 docker CLI,支持 profiles、deploy.resources 等现代配置语法,并具备更优性能与内存效率。Ubuntu 20.04 因软件源长期冻结,apt 仅提供已弃用的 Python 编写的 v1 版本(如 1.25.0),导致配置不兼容、命令失效及生产隐患。正确启用 v2 需绕过 apt,通过官方二进制下载或源码构建方式部署,并完成路径优先级、CLI 插件注册与配置验证三重确认。该

weixin_34203832的博客 426

Ubuntu 20.04 + Docker 部署 Discourse 论坛完整指南

Discourse 是一款基于 Ruby on Rails 构建的现代化开源论坛系统,其核心架构采用微服务设计,依赖 PostgreSQL、Redis、Nginx 等多个组件协同工作。为保障部署一致性与运维可靠性,官方强制推荐 Docker 容器化部署模式,彻底摒弃传统手动编译或包管理安装方式。该方案通过预构建镜像封装全部运行时依赖,显著降低 Ruby 版本冲突、SSL 证书申请失败、数据库配置错误等高频故障风险。在宿主系统选型上,Ubuntu 20.04 因其长期支持周期、Docker 生态成熟度及内核

weixin_30267785的博客 401

SystemVerilog Assertions - Design Tricks and SVA Bind Files_pres

There are some simple tricks that every design engineer should know to facilitate the usage of SystemVerilog Assertions. Although this paper is not intended to be a comprehensive tutorial on SystemVerilog Assertions, it is worthwhile to give a simplified definition of a property and the concurrent assertion of a property. 1.1 What is an assertion? An assertion is basically a "statement of fact" or "claim of truth" made about a design by a design or verification engineer. An engineer will assert or "claim" that certain conditions are always true or never true about a design. If that claim can ever be proven false, then the assertion fails (the "claim" was false). Assertions essentially become active design comments, and one important methodology treats them exactly like active design comments. More on this in Section 2. A trusted colleague and formal analysis expert[1] reports that for formal analysis, describing what should never happen using "not sequence" assertions is even more important than using assertions to describe always true conditions. 1.2 What is a property? A property is basically a rule that will be asserted (enabled) to passively test a design. The property can be a simple Boolean test regarding conditions that should always hold true about the design, or it can be a sampled sequence of signals that should follow a legal and prescribed protocol. For formal analysis, a property describes the environment of the block under verification, i.e. what is legal behavior of the inputs. 1.3 Two types of SystemVerilog assertions SystemVerilog has two types of assertions: (1) Immediate assertions (2) Concurrent assertions Immediate assertions execute once and are placed inline with the code. Immediate assertions are not exceptionally useful except in a few places, which are detailed in Section 3.

Binding System Verilog Module to VHDL design

Binding System Verilog Module to VHDL design. A pretty good article guiding you how to bind system verilog module to VHDL design. Especially useful in mixed signal model.

SystemVerilog与功能验证

详细讲解了IC验证流程,包括搭建测试环境,以及常用测试语言,详细讲解了SystemVerilog语法以及实际用例。

解决vscode无法运行npm命令的问题(cmd可行)

Powershell以及vscode中npm命令使用不了

无痕坚守本心的博客 2751

基于 parallels ubuntu 20.04 LTS (focal) 的ros+px4+gazebo 安装

基于 parallels ubuntu 20.04 LTS (focal) 的ros+px4+gazebo 安装。

weixin_40132006的博客 2242

【驭风计划 机器学习】实验6 基于集成学习的 Amazon 用户评论质量预测

¶随着电商平台的兴起,以及疫情的持续影响,线上购物在我们的日常生活中扮演着越来越重要的角色。在进行线上商品挑选时,评论往往是我们十分关注的一个方面。然而目前电商网站的评论质量参差不齐,甚至有水军刷好评或者恶意差评的情况出现,严重影响了顾客的购物体验。因此,对于评论质量的预测成为电商平台越来越关注的话题,如果能自动对评论质量进行评估,就能根据预测结果避免展现低质量的评论。本案例中我们将基于集成学习的方法对 Amazon 现实场景中的评论质量进行预测。

Mege1的博客 474

oh-my-zsh详细安装与主题插件配置

使用Linux的小伙伴都知道默认shell是bash,但是对于喜欢折腾,喜欢酷炫的我们bash怎能够用。zsh的作为一种shell,功能更强大,但是配置复杂。后来,有大佬创建了一个名为oh-my-zsh的开源项目,使用方便,功能强大。 下面就去oh-my-zsh的配置。 ①安装zsh 想要安装oh-my-zsh,首先得安装zsh,输入命令 sudo apt-get install zsh 界面如下 ②查看是否安装成功 输入命令 zsh --version 可以查看安装zsh的版本..

惜洛-Jankin的博客 2万+

关于Arduino中的常用函数

一、I/O函数 二、时间函数 三、数学函数 abs 返回其参数的无符号值 【abs(12)返回12,abs(-12)也返回12】 constrain 限制一个数字以阻止它超出范围。第一个参数是被限制的数字,第二个参数是范围区间的开始,第三个参数是允许的数字范围区间的结尾。 【constrain(8,1,10)返回8,constrain(11,1,10)返回10,constrain(0,1,10)返回1】 map 将一个范围内的数字映射到另一个范围。第一个参数是要映射到数字,第二个和第三个参数是from范围(

TREE的博客 7328

FDTD Script命令学习-farfield3d/farfieldux/farfielduy

介绍了farfield3d/farfieldux/farfielduy命令功能,及不同应用语法和参数介绍,以及对官网示例进行介绍。

jxxl_1314的博客 3101

5分钟搞定CST周期性结构仿真:共面波导色散曲线快速生成技巧

本文提供了一套在CST Studio Suite中快速仿真周期性结构并生成色散曲线的标准化流程。针对共面波导设计,重点解析了周期性边界条件的核心设置、本征模求解器(JDM算法)的优化技巧,以及通过参数扫描与后处理模板实现自动化,旨在帮助射频与微波工程师在5分钟内高效完成关键性能验证。

blue的专栏 1252

uniapp - 微信授权登录报错 errMsg“:“login:fail send“ | “code“:-100 | “innerCode“:-6,解决uni-app调用微信登录时没有响应且返回错误

uni-app,微信登录,微信登录报错,微信小程序,支付宝小程序,安卓app,苹果ios,nvue,H5网页网站,uniapp苹果安卓app,微信授权登录,uniAppAPP端微信登录报错,微信确认登录界面后点击登录报错,"errMsg":"login:failsend","errCode":-100,"code":-100,"innerCode":-6,都配置好了还是报错怎么办,uniapp微信授权登录报错,UniApph5对接微信登录出现错误,appid,应用签名,微信登陆,code:-100

🏆 前端领域优质创作者 1万+

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

深度学习工具包 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")

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

上一篇: 多路监控视频实时拼接技术:从鱼眼矫正到全景融合的实战解析
下一篇: 从零开始:手把手教你用DEVICE_ATTR_RW构建Linux设备属性文件
sql99
博客等级 码龄19年 168粉丝 1905原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值