docker学习-安装及基本命令使用

docker安装及使用说明 测试 Docker 是否安装正确。 阅读详情

基本安装

1.1Ubuntu14.04环境

1.sudo apt-get update

2.sudo apt-get install linux-image-generic-lts-trusty

3.wget安装sudoapt-get install wget

4.最新Docker安装:wget -qO- https://get.docker.com/ | sh

5.验证安装 sudodocker run hello-world

1.2Mac/Windows 环境

安装Docker ToolBox即可

基本命令

1.启动一次性运行的容器

sudo docker run ubuntu:14.04 /bin/echo ‘Hello world’

从ubuntu:14.04镜像启动一个容器,成功后在容器内部执行/bin/echo ‘hello world’命令,如果当前物理机没有该镜像,则执行docker pull从Docker Hub获取镜像,执行成功后,容器立马停止

参数解释

Docker run:docker中的启动容器命令

Ubuntu:镜像名称

14:04:镜像TAG,如果不指定TAG,docker使用最新的发行版TAG:latest

/bin/echo ‘Helloworld’:在容器内执行的命令

该命令执行过程

l 如果本地有ubuntu这个image就从它创建容器,否则从公有仓库下载

l 从image创建容器

l 分配一个文件系统,并在只读的image层外面挂载一层可读写的层

l 从宿主主机配置的网桥接口中桥接一个虚拟接口到容器中去

l 从地址池配置1个ip地址给容器

l 执行你指定的程序,在这里启动一个/bin/bash

2.启动交互模式容器

以交互模式启动一个容器(具体参数意义请执行dockerrun –help)

$ sudo docker run -t-i ubuntu:14.04/bin/bash

参数解释

-t:开启一个终端

-i:以交互模式运行

3.退出当前容器

$sudo exit //在容器内部执行该命令(或crtl+D),一般在交互模式下退出当前容器

4.docker外部命令

重启容器:#sudodocker restart 容器ID

暂停容器:#sudodocker pause 容器ID

sudo docker unpause 容器ID //解除暂停

停止容器:$sudodocker stop 容器ID或容器名称

docker stop $(docker ps -q -a) //一次性停止所有容器,慎用

杀死容器:$sudodocker kill 容器ID或容器名称

删除容器:$sudo docker rm 容器ID或容器名称

文件复制:主机—>容器docker cpfile.txt containerId:/file.txt

5.镜像相关

镜像查看:#sudodocker images //在本机进行镜像查看

sudo docker inspect 镜像ID //查看单个镜像的具体信息,以JSON格式返回

获取镜像:# sudodocker pull centos //从DockerHub获取镜像

查询镜像:#sudodocker search 镜像名称 //从DockerHub按照镜像名称模拟查询镜像

6.网络模式—host

$ sudo docker run –net=host -t-i ubuntu:14.04 /bin/bash

与宿主共享NetworkNamespace,即通过宿主ip可直接进行访问

DeepSeek跨会话协作指南:让AI成为你的「第二大脑」 通过DeepSeek的跨会话协作系统,用户实测工作效率提升63%。 阅读详情

相关推荐

RedPitaya火龙果板基础操作

火龙果板基础操作一级目录二级目录三级目录 一级目录 二级目录 三级目录

qq_41523340的博客 9721

Docker学习(二)-----Docker安装和使用

本章我们就来学习docker的安装和初步使用。 Linux CentOS Docker 安装 Docker支持以下的CentOS版本: CentOS 7 (64-bit) CentOS 6.5 (64-bit) 或更高的版本 前提条件 目前,CentOS 仅发行版本中的内核支持 Docker。 Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3....

直到世界的尽头 1861

frp 内网渗透案例:端口转发 + 二级代理(深入理解 frp 在内网渗透中的技巧)

本文使用 vulnstack7 靶场作为测试环境,解释 frp 内网渗透特殊使用姿势,通过此案例来提高内网渗透能力。接下来的演示环境只做了以下修改。攻击者 vps 的 ip 修改为:192.168.72.162。DMZ 区域的 ubuntu 的 ip1 修改为:192.168.72.129。先引入问题,当我们控制了 DMZ 的 ubuntu 并且拿到第二层网络的 ubuntu 的 rce 后,会出现以下两个问题。如何搭建隧道让 ubuntu 反弹 shell 给攻击者 vps?

anddddoooo的博客 1765

Docker 新手小白保姆级教程:从安装到基础操作全搞定

作为一名刚接触容器技术的新手,是不是觉得 Docker 又神秘又难学?其实 Docker 的核心逻辑很简单 ——“一次构建,到处运行”,能帮我们解决环境配置不一致、依赖冲突等一系列头疼问题。今天这篇教程,就从各系统安装 Docker讲到镜像 / 容器核心操作,全程步骤清晰、命令可直接复制,新手也能快速上手!在学之前先搞懂:Docker 到底能帮我们做什么?接下来,咱们一步步从安装开始入手~Docker 分为「Docker Engine」(核心运行环境)和「Docker Desktop」(图形化界面,可选),

qq_40324073的博客 1342

告别重复劳动:用Python+pywinauto打造你的微信个人助理(自动回复/收款/定时发消息)

本文介绍如何利用Python和pywinauto库构建微信个人助手,实现自动回复、定时消息、智能收款等功能,告别重复劳动。通过详细的代码示例和配置指南,帮助开发者快速掌握微信自动化技术,提升工作效率。

weixin_42568801的博客 330

【AI编程】Qoder AI 编程工具从部署到深度使用实战详解

Qoder AI 编程工具从部署到深度使用实战详解

congge 8339

Docker中运行“hello Word”应用

在Docker中运行"hello Word"应用Docker在容器内运行应用程序。在一个容器内运行一个应用程序需要一个命令:docker run。Hello word让我们现在来试试 $ sudo docker run ubuntu:14.04 /bin/echo 'Hello world' Hello world刚刚你运行了你的第一个容器!所以刚才发生了什么?让我们来看看docke...

Kim_Weir的专栏 927

Python之afdx包语法、参数和实际应用案例

Python 的 afdx 包是针对 AFDX 协议的轻量级开发工具,专注于 AFDX 数据帧的解析、构造、发送/接收、协议合规性校验等核心能力,广泛应用于航空电子设备测试、仿真、数据监控等场景。

王国平的博客 982

ubuntu中docker安装后sudo docker run hello-world出现Unable to find image 'hello-world:latest' locally原因和解决

问题描述: 在ubantu中安装了docker后,使用命令sudo docker run hello-world出现问题 Unable to find image 'hello-world:latest' locally 这是由于docker的服务器不在国内,服务器以及许多仓库内的镜像在国外,由于“墙”的原因,如果不修改或者添加源就会显示连接不上,话不多说,直接来。 解决方法: 在docker配...

落墨画雪的博客 7162

Python爬虫技术:使用Playwright和Twitter API v2高效获取Twitter/X数据完全教程

遵守规则:始终遵循Twitter的使用条款和速率限制错误处理:实现完善的错误处理和重试机制数据质量:进行数据清洗和验证性能优化:使用异步处理和合理的延迟设置可维护性:模块化代码,便于维护和扩展。

2201_76125261的博客 671

nvidia系列教程-AGX-Orin基础环境搭建

NVIDIA Jetson AGX Orin 是一款功能强大的嵌入式AI平台,专为需要高性能和低功耗的边缘计算应用设计。无论是自动驾驶、机器人,还是智能监控系统,Jetson AGX Orin 都能为这些应用提供强大的计算能力。本篇博客将为大家详细介绍如何在AGX Orin(32GB)上搭建基础开发环境,包括系统安装、CUDA和cuDNN的配置等,帮助你快速上手这个强大的平台。架构: 搭载 56 个 Tensor Core 的 1792 核 NVIDIA Ampere c GPUCUDA Cores。

flypig has a dream! 2796

Docker (一) 运行容器

Docker 应用 "hello World"Docker 允许你在容器内运行应用程序, 使用docker run命令来在容器内运行一个应用程序。Hello world现在让我们来试试$sudodockerrunubuntu:14.04/bin/echo'Helloworld' Helloworld刚才你启动了你的第一个容器!那么刚才发生了什么? 我们逐步...

weixin_33834679的博客 274

Vue - 最新详细实现滑块拖动拼图验证,网站登录验证滑块验证功能,拖动滑块到图片缺口的位置即为成功,滑块验证安全检测(详细示例代码,一键复制运行)

您一定见过很多系统都“配备”了滑块验证、拼图验证、找不同等,本质上都是为了验证登录系统的是人还是机器(代码),如下图所示效果: 您打开项目根目录,终端执行如下命令:拼图式拖动滑块验证 验证拖动滑块验证,滑动拼图/图片点选验证 接下来,在中加入以下代码: 如下图所示: 更多配置示例和参数详见官方文档,以下便是如上效果图的代码:.........

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

Docker入门学习:基本概念、安装、命令、简单使用

Docker入门学习

雅俗共赏的博客 3641

WINCC7.3破解文件

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

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Docker学习笔记-1:安装与基本命令使用

自动部署、docker容器

spb229443329的专栏 271

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

docker如何学习与使用入门

学习 Docker 的过程包括理解容器化的基本概念、安装 Docker、掌握基本命令、构建自己的镜像和容器、学习如何管理多个容器的应用。通过多实践项目,能够有效提升你的 Docker 使用能力。

牛马日常踩坑记录 1491

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

【网络安全---docker】kali上安装docker,CentOS上安装docker,docker命令详解_kali安装docker

镜像就是别人安装好软件,我们可以直接从远程镜像仓库下载,运行,免去了解压流程;下载到本地的叫本地镜像(images),下载好的镜像运行以后就叫容器(container);或者远程镜像可以直接一个命令下载直接运行成容器;镜像运行之后就叫容器。

2401_84215240的博客 1406

学习docker需要linux吗

我整理的一些关于【Docker】的项目学习资料(附讲解~~)和大家一起分享、学习一下:https://d.51cto.com/xltfov学习 Docker 需要 Linux 吗? 引言 Docker 是一个开源的平台,用于自动化部署、扩展和管理应用程序。Docker 的强大之处在于它提供了一种轻量级的虚拟化方式,使得应...

weixin_37036882的博客 134

深度学习docker环境配置之nvidia-docker安装使用

docker容器技术–。:Anaconda用于隔离不同的python环境;docker可以理解成在你的机器里面安装了一个独立的系统,因此它可以隔离不同的CUDA环境,还有着独立的文件系统,防止别人删掉你的实验和环境等。

qq_41776453的博客 2万+

云计算技术 实验一 安装docker系统并熟悉docker命令

环境为windows11,虚拟机为16.04。

m0_53227534的博客 1843

Mac使用docker及docker-machine命令

1.使用brew 安装docker, boot2docker及docker-machine 2、基本使用 查看当前的machine: docker-machine ls 创建一个dockermachine: docker-machine create --driver virtualbox test 更改环境变量,使得本地docker指向docker-machi

warren_1992的博客 7494

Docker学习: Docker介绍和安装以及常用命令

Docker学习: Docker介绍和安装以及常用命令

LiuYQi的博客 820

Docker介绍以及它的常用命令

Docker介绍 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器或Windows 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口,但是容器和本机之间可以存在接口并进行通信,比如使用tcp/udp协议进行容器和本机之间的通信。 本文通过在各种环境下安装开源软件Docker,然后学习使用常用的Docker命令,掌握开源Docker的基本工作原理,最后使用Docker搭建一个flaskweb,完成.

qq_41427568的博客 1460

【docker 】Windows10安装 Docker

Hyper-V 是微软开发的虚拟机,仅适用于 Windows 10。选中Hyper-V 点击确定。

一个写了10年bug的程序员日常笔记。 2334

Docker新手使用教程

在你项目的根目录创建一个名为 Dockerfile (注意没有文件后缀) 的文件。在 Dockerfile 中写入构建镜像的指令。在你项目根目录下,使用。

星辰火之梦 1179

docker的使用以及常用命令

Docker 是一个开源的应用容器引擎,它允许开发者将应用程序及其依赖打包成一个容器,然后运行在任何支持 Docker 的机器上。容器化的应用程序可以在开发、测试和生产环境中保持一致性,从而简化了部署和扩展过程。Docker 的使用远不止于此,但掌握这些基础命令已经足够您开始 Docker 之旅。随着实践的深入,您将逐渐发现 Docker 强大的功能和便捷之处。记得,实践是最好的学习方式,不要害怕尝试和犯错。

浮游的博客 520
上一篇: APK瘦身实践
下一篇: canvas+video实现跨域视频截图
xb_smart
博客等级 码龄16年 124粉丝 74原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值