南充建网站的资料ps详情页模板

当前位置: 首页 > news >正文

南充建网站的资料,ps详情页模板,有哪些做兼职的设计网站有哪些工作内容,asp.net网站开发书籍在文章《Windows Docker笔记-Docker容器操作》中#xff0c;已经成功创建了容器#xff0c;也就是建好了工厂#xff0c;接下来就应该要安装流水线设备#xff0c;即运行项目达到生产的目的。 在Ubuntu容器中新建项目 这里要新建一个简单的C项目#xff0c;步骤如下已经成功创建了容器也就是建好了工厂接下来就应该要安装流水线设备即运行项目达到生产的目的。 在Ubuntu容器中新建项目 这里要新建一个简单的C项目步骤如下

  1. 安装g编译环境 使用 docker start myUbuntu启动myUbuntu容器 使用 docker ps -a查看容器运行状态 使用 docker exec -it myUbuntu /bin/bash进入容器终端 使用 apt-get update更新软件包索引 使用 apt-get install g安装g软件包 使用 g –version查看安装的g版本
    D:\本周未完成工作\dockerdocker start myUbuntu myUbuntuD:\本周未完成工作\dockerdocker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES da3b54c08bd5 ubuntu:latest /bin/bash 18 hours ago Up 3 seconds myUbuntuD:\本周未完成工作\dockerdocker exec -it myUbuntu /bin/bash rootda3b54c08bd5:/# apt-get update Get:1 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB] Get:2 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB] [此处省略部分过程代码] Fetched 28.1 MB in 19s (1487 kB/s) Reading package lists… Done rootda3b54c08bd5:/# apt-get install g Reading package lists… Done Building dependency tree… Done Reading state information… Done The following additional packages will be installed: [此处省略部分过程代码] The following NEW packages will be upgraded:g g-13 g-13-x86-64-linux-gnu g-x86-64-linux-gnu gcc libstdc-13-dev 0 upgraded, 6 newly installed, 0 to remove and 12 not upgraded. Need to get 14.6 MB of archives. After this operation, 56.6 MB of additional disk space will be used. Do you want to continue? [Y/n] Y [此处省略部分过程代码] Setting up gcc (4:13.2.0-7ubuntu1) … Setting up libstdc-13-dev:amd64 (13.3.0-6ubuntu2~24.04) … Setting up g-13-x86-64-linux-gnu (13.3.0-6ubuntu2~24.04) … Setting up g-x86-64-linux-gnu (4:13.2.0-7ubuntu1) … Setting up g-13 (13.3.0-6ubuntu2~24.04) … Setting up g (4:13.2.0-7ubuntu1) … update-alternatives: using /usr/bin/g to provide /usr/bin/c © in auto mode update-alternatives: warning: skip creation of /usr/share/man/man1/c.1.gz because associated file /usr/share/man/man1/g.1.gz (of link group c) doesnt exist rootda3b54c08bd5:/# g –version g (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 Copyright © 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.rootda3b54c08bd5:/#到这里 g 编译环境就安装好了。
  2. 安装vim vim用来编辑代码文件使用。 rootda3b54c08bd5:/# apt-get install vim Reading package lists… Done Building dependency tree… Done Reading state information… Done The following additional packages will be installed: [此处省略部分过程代码] update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode Processing triggers for libc-bin (2.39-0ubuntu8.4) … rootda3b54c08bd5:/#vim –version VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 16 2025 20:13:18) Included patches: 1-16, 647, 678, 697 Modified by teamvimtracker.debian.org Compiled by teamvimtracker.debian.org [此处省略部分过程代码]到这里 vim 编辑工具就安装好了。
  3. 新建项目 这里的项目直接使用文章《CMake项目中神器CMakeLists.txt》中的第一个项目代码如下图所示。 #include iostreamint Func_Add(int num1, int num2) {int nSum num1 num2;return nSum; }int main() {int numSum Func_Add(2, 3);std::cout 2 3 numSum std::endl;return 0; } 步骤如下 在/home/目录下新建test目录 在test目录中使用vim main.cpp新建main.cpp文件 将上述代码编辑到main.cpp中 保存并退出文件
    rootda3b54c08bd5:/# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var rootda3b54c08bd5:/# cd /home/ rootda3b54c08bd5:/home# ls ubuntu rootda3b54c08bd5:/home# mkdir test rootda3b54c08bd5:/home# cd test/ rootda3b54c08bd5:/home/test# vim main.cpp rootda3b54c08bd5:/home/test# cat main.cpp #include iostreamint Func_Add(int num1, int num2) {int nSum num1 num2;return nSum; }int main() {int numSum Func_Add(2, 3);std::cout 2 3 numSum std::endl;return 0; } rootda3b54c08bd5:/home/test#4. 编译项目并运行 使用g命令编译项目文件 使用./可执行文件名 运行文件
    rootda3b54c08bd5:/home/test# g -o main main.cpp rootda3b54c08bd5:/home/test# ls main main.cpp rootda3b54c08bd5:/home/test# ./main 2 3 5 rootda3b54c08bd5:/home/test#代码此时已经正常运行了。运行的程序就相当于流水线设备运行结果就相当于到生产的玩具。 上述项目只是一个简单的例子你可以把这个Ubuntu的容器当成一个Linux的开发环境来使用在里面编译你实际的项目代码然后运行。比使用虚拟机要好很多。非常的Nice 使用外部现有程序放到容器中运行 类比一下上面的容器中新建项目运行相当于工厂自己生产流水线设备自给自足。另外一种情况是直接购买流水线设备安装到工厂后直接运行。这种就相当于将外部已经编译好的程序放到容器中运行一样。显然docker也提供了这种方法方便运维这样容器就只提供运行环境就好就不用提供编译开发环境轻量了很多。 注意以下操作需要先使用 e x i t 命令退出容器在容器外部操作。 \color{red}{注意以下操作需要先使用exit命令退出容器在容器外部操作。} 注意以下操作需要先使用exit命令退出容器在容器外部操作。 这里文件演示需要将上述生成的可执行文件 main 先保存到本地磁盘然后删除到容器中的项目在将本地可执行文件 main 导入容器中运行。
  4. docker cp 命令说明 命令docker cp 是 Docker 的一个命令用于在容器和主机之间复制文件或文件夹。它类似于 Linux 的 cp 命令但专门用于操作 Docker 容器中的文件。 格式 docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH docker cp [OPTIONS] SRC_PATH CONTAINER:DEST_PATH CONTAINER:SRC_PATH容器内的源文件路径。DEST_PATH主机上的目标路径。SRC_PATH主机上的源文件路径。CONTAINER:DEST_PATH容器内的目标路径。 常见用法 从容器复制文件到主机 将容器中的文件复制到主机的指定路径 命令docker cp container_id:/path/to/source/file /path/to/destination/on/host 案例docker cp my_container:/app/config.txt /home/user/config_backup.txt从主机复制文件到容器 将主机上的文件复制到容器的指定路径 命令docker cp /path/to/source/file container_id:/path/to/destination/in/container 案例docker cp /home/user/new_config.txt my_container:/app/config.txt 1. 将编译好的可执行文件 main 保存到本地磁盘中 命令docker cp myUbuntu:/home/test/main ./ # ./表示本地当前目录 rootda3b54c08bd5:/home/test# exit exitD:\本周未完成工作\dockerdocker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES da3b54c08bd5 ubuntu:latest /bin/bash 20 hours ago Up 2 hours myUbuntuD:\本周未完成工作\dockerdocker cp myUbuntu:/home/test/main ./ Successfully copied 18.4kB to D:\本周未完成工作\docker.\D:\本周未完成工作\dockerdir驱动器 D 中的卷是 Data卷的序列号是 F6F0-A014D:\本周未完成工作\docker 的目录2025/02/07 15:39 DIR . 2025/02/07 15:39 DIR .. 2025/02/07 10:54 16,584 main 2025/01/20 17:34 75,203,584 ubuntu.tar2 个文件 75,220,168 字节2 个目录 382,717,251,584 可用字节D:\本周未完成工作\docker上述退出容器后使用docker cp 将容器中的main可执行文件保存到了本地目录D:\本周未完成工作\docker 下面。
  5. 清理容器中的项目相关文件 D:\本周未完成工作\dockerdocker exec -it myUbuntu /bin/bash rootda3b54c08bd5:/# cd /home/test/ rootda3b54c08bd5:/home/test# rm -rf * rootda3b54c08bd5:/home/test# ls rootda3b54c08bd5:/home/test#3. 将本地编译好的可执行文件 main 导入容器中运行 命令docker cp ./main myUbuntu:/home/test/ rootda3b54c08bd5:/home/test# exit exitD:\本周未完成工作\dockerdocker cp ./main myUbuntu:/home/test/ Successfully copied 18.4kB to myUbuntu:/home/test/D:\本周未完成工作\dockerdocker exec -it myUbuntu /bin/bash rootda3b54c08bd5:/# cd /home/test/ rootda3b54c08bd5:/home/test# ls main rootda3b54c08bd5:/home/test# ./main 2 3 5 rootda3b54c08bd5:/home/test#可以看到容器中有了运行环境直接使用外部导入的程序就可以运行了。 如果项目较大需要的以来很多可以导入程序后运行调试根据报错信息安装依赖包即可。 上一章Windows Docker笔记-Docker容器操作 下一章Windows Docker笔记-制作、加载镜像