【Docker】03 容器操作

news2024/10/1 15:20:01

文章目录

  • 一、流转图
  • 二、基本操作
    • 2.1 查看本地容器进程
    • 2.2 启动容器
      • 2.2.1 交互式启动容器
      • 2.2.2 后台启动容器
    • 2.3 进入容器
    • 2.4 停止启动重启容器
    • 2.5 退出容器
    • 2.6 删除容器
    • 2.7 提交容器(打包成镜像)
    • 2.8 拷贝文件
      • 2.8.1 拷贝容器内文件到宿主机
      • 2.8.2 拷贝宿主机文件到容器内
    • 2.9 容器日志
    • 2.10 容器进程信息
    • 2.11 容器元数据
    • 2.12 查看容器状态
    • 2.13 其他
  • 三、高级操作
    • 3.1 映射端口
    • 3.2 挂载数据卷
      • 3.2.1 自定义数据卷目录
      • 3.2.2 自动数据卷目录
    • 3.3 传递环境变量
    • 3.4 容器内安装软件


一、流转图

在这里插入图片描述

二、基本操作

2.1 查看本地容器进程

#docker-ps

# -a 所有,包括运行的和已退出的
[root@server ~]# docker ps -a  
CONTAINER ID   IMAGE         COMMAND    CREATED      STATUS                  PORTS     NAMES
02b2d2343a23   hello-world   "/hello"   8 days ago   Exited (0) 8 days ago             festive_meninsky

[root@server ~]# docker ps -n 2   # 显示正在运行的容器中最新的2个
[root@server ~]# docker ps     # 显示当前正在运行的容器
[root@server ~]# docker ps -q  # 显示正在运行的容器ID

2.2 启动容器

#docker-run

2.2.1 交互式启动容器

-i表示交互,-t表示(后跟)指定伪终端

[root@server ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
alpine        latest    f8c20f8bbcb6   5 weeks ago    7.38MB
hello-world   latest    d2c94e258dcb   8 months ago   13.3kB

[root@server ~]# docker run -it alpine /bin/sh
/ # ls
bin    etc    lib    mnt    proc   run    srv    tmp    var
dev    home   media  opt    root   sbin   sys    usr
/ # 

此时可看到有容器进程:

[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED         STATUS         PORTS     NAMES
908b5182365c   alpine    "/bin/sh"   7 seconds ago   Up 5 seconds             interesting_bhabha
[root@server ~]# 

若退出容器,则容器进程也会结束,因为容器内没有进程在运行着,且没有指定后台运行容器。

2.2.2 后台启动容器

-d表示后台运行

[root@server ~]# docker run -td --name myalpine alpine:latest
9ce9f829f6e66b354a2b806e07d2148754fe7bb710f2e1993d46b2661833a39f
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED          STATUS          PORTS     NAMES
9ce9f829f6e6   alpine    "/bin/sh"   25 seconds ago   Up 24 seconds             myalpine
[root@server ~]# 

2.3 进入容器

#docker-exec
进入容器时开启一个新的终端:

[root@server ~]# docker exec -it 9ce9f829f6e6 /bin/sh
/ # exit
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED         STATUS              PORTS     NAMES
9ce9f829f6e6   alpine    "/bin/sh"   5 minutes ago   Up About a minute             myalpine

#docker-attach
进入当前正在运行的容器终端:

[root@server ~]# docker attach 9ce9f829f6e6

2.4 停止启动重启容器

#docker-stop
#docker-start
#docker-restart

[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED         STATUS         PORTS     NAMES
9ce9f829f6e6   alpine    "/bin/sh"   2 minutes ago   Up 2 minutes             myalpine
[root@server ~]# docker stop 9ce9f829f6e6
9ce9f829f6e6
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@server ~]# docker start 9ce9f829f6e6
9ce9f829f6e6
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED         STATUS        PORTS     NAMES
9ce9f829f6e6   alpine    "/bin/sh"   3 minutes ago   Up 1 second             myalpine
[root@server ~]# docker restart 9ce9f829f6e6
9ce9f829f6e6
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED         STATUS        PORTS     NAMES
9ce9f829f6e6   alpine    "/bin/sh"   3 minutes ago   Up 1 second             myalpine
[root@server ~]# 

2.5 退出容器

exit           # 容器停止并退出(容器内没有进程在运行)
Ctrl + P + Q   # 容器不停止退出

2.6 删除容器

#docker-rm

[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED          STATUS          PORTS     NAMES
9ce9f829f6e6   alpine    "/bin/sh"   17 minutes ago   Up 13 minutes             myalpine

[root@server ~]# docker rm myalpine
Error response from daemon: You cannot remove a running container 9ce9f829f6e66b354a2b806e07d2148754fe7bb710f2e1993d46b2661833a39f. Stop the container before attempting removal or force remove
[root@server ~]# docker stop myalpine
myalpine
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@server ~]# docker rm myalpine  
myalpine

[root@server ~]# docker ps -a
CONTAINER ID   IMAGE         COMMAND     CREATED          STATUS                      PORTS     NAMES
908b5182365c   alpine        "/bin/sh"   22 minutes ago   Exited (0) 20 minutes ago             interesting_bhabha
02b2d2343a23   hello-world   "/hello"    8 days ago       Exited (0) 8 days ago                 festive_meninsky
[root@server ~]# 

若容器正在运行中仍要被删除,则需使用docker rm -f强制删除

删除已停止运行的容器中的第一个容器:

[root@server ~]# for i in `docker ps -a | grep -i exit | sed '1d' | awk '{print $1}'`;do docker rm -f $i;done
02b2d2343a23
[root@server ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND     CREATED          STATUS                      PORTS     NAMES
908b5182365c   alpine    "/bin/sh"   24 minutes ago   Exited (0) 23 minutes ago             interesting_bhabha
[root@server ~]# 

2.7 提交容器(打包成镜像)

#docker-commit

[root@server ~]# docker start 908b5182365c
908b5182365c
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND     CREATED          STATUS         PORTS     NAMES
908b5182365c   alpine    "/bin/sh"   36 minutes ago   Up 5 minutes             interesting_bhabha

# 添加作者、描述,指定容器ID,加上镜像名:Tag
[root@server ~]# docker commit -a="auther" -m="this is a comment" 908b5182365c myalpine:1.0.0
sha256:9cc4b0832b11004cbca8b55dbdde69647d0851d002b3e629d9bad149a8ce5424

[root@server ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
myalpine      1.0.0     9cc4b0832b11   4 seconds ago   7.38MB
alpine        latest    f8c20f8bbcb6   5 weeks ago     7.38MB
hello-world   latest    d2c94e258dcb   8 months ago    13.3kB

2.8 拷贝文件

#docker-cp

2.8.1 拷贝容器内文件到宿主机

docker cp 容器id:容器内路径  宿主机目的路径

docker cp 55321bcae33d:/test.java /        # 拷贝到宿主机 / 根目录下

2.8.2 拷贝宿主机文件到容器内

docker cp 文件or目录名 容器ID:/路径

2.9 容器日志

#docker-logs

[root@server ~]# docker run hello-world 2>&1 >> /dev/null
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@server ~]# docker ps -a | grep hello
de258d79d2af   hello-world   "/hello"    18 seconds ago   Exited (0) 17 seconds ago             elastic_mendel
[root@server ~]# docker logs -f de258d79d2af

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
[root@server ~]# docker logs --help

Usage:  docker logs [OPTIONS] CONTAINER

Fetch the logs of a container

Aliases:
  docker container logs, docker logs

Options:
      --details        Show extra details provided to logs
  -f, --follow         Follow log output
      --since string   Show logs since timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m"
                       for 42 minutes)
  -n, --tail string    Number of lines to show from the end of the logs (default "all")
  -t, --timestamps     Show timestamps
      --until string   Show logs before a timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m"
                       for 42 minutes)

查看倒数5行日志,并打上时间戳(-t):

[root@server ~]# docker logs --tail 5 de258d79d2af
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
 
[root@server ~]# docker logs --tail 5 -t de258d79d2af 
2024-01-20T09:17:28.063983170Z  https://hub.docker.com/
2024-01-20T09:17:28.063985026Z 
2024-01-20T09:17:28.063986546Z For more examples and ideas, visit:
2024-01-20T09:17:28.063988103Z  https://docs.docker.com/get-started/
2024-01-20T09:17:28.063989639Z 

-f跟踪日志:

[root@server ~]# docker run -d centos /bin/sh -c "while true;do echo helloworld;sleep 1;done" 
Unable to find image 'centos:latest' locally
latest: Pulling from library/centos
a1d0c7532777: Pull complete 
Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
Status: Downloaded newer image for centos:latest
d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c
[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS         PORTS     NAMES
d9137e0fd7ea   centos    "/bin/sh -c 'while t…"   10 seconds ago   Up 7 seconds             determined_tharp
[root@server ~]# docker logs -tf -n5 d9137e0fd7ea
2024-01-20T09:23:42.471835910Z helloworld
2024-01-20T09:23:43.476544231Z helloworld
2024-01-20T09:23:44.479378544Z helloworld
2024-01-20T09:23:45.488346985Z helloworld
2024-01-20T09:23:46.491736593Z helloworld
2024-01-20T09:23:47.497556758Z helloworld
2024-01-20T09:23:48.507944232Z helloworld
2024-01-20T09:23:49.515828873Z helloworld

2.10 容器进程信息

#docker-top

查看容器中进程信息:

[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED              STATUS              PORTS     NAMES
d9137e0fd7ea   centos    "/bin/sh -c 'while t…"   About a minute ago   Up About a minute             determined_tharp
[root@server ~]# docker top d9137e0fd7ea
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                29345               29325               0                   17:23               ?                   00:00:00            /bin/sh -c while true;do echo helloworld;sleep 1;done
root                29590               29345               0                   17:25               ?                   00:00:00            /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1

2.11 容器元数据

#docker-inspect

[root@server ~]# docker inspect d9137e0fd7ea
[
    {
        "Id": "d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c",
        "Created": "2024-01-20T09:23:24.883298959Z",
        "Path": "/bin/sh",
        "Args": [
            "-c",
            "while true;do echo helloworld;sleep 1;done"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 29345,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2024-01-20T09:23:26.389867521Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:5d0da3dc976460b72c77d94c8a1ad043720b0416bfc16c52c45d4847e53fadb6",
        "ResolvConfPath": "/var/lib/docker/containers/d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c/hostname",
        "HostsPath": "/var/lib/docker/containers/d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c/hosts",
        "LogPath": "/var/lib/docker/containers/d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c/d9137e0fd7ea7799f65ba6f470723629610df41fc0735de60ff1f6ebeea2939c-json.log",
        "Name": "/determined_tharp",
        ...

2.12 查看容器状态

#docker-stats

[root@server ~]# docker stats
CONTAINER ID   NAME               CPU %     MEM USAGE / LIMIT     MEM %     NET I/O     BLOCK I/O     PIDS
d9137e0fd7ea   determined_tharp   0.15%     3.941MiB / 846.4MiB   0.47%     656B / 0B   11.2MB / 0B   2

2.13 其他

Docker运行容器时,可设置分配CPU权重、绑核等操作。

分配CPU权重 --cpu-shares
taskset 把进程绑定到特定CPU核上
stress 压力测试

三、高级操作

拉取nginx镜像,做好后续操作的环境准备工作:

[root@server ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
2f44b7a888fa: Pull complete 
8b7dd3ed1dc3: Pull complete 
35497dd96569: Pull complete 
36664b6ce66b: Pull complete 
2d455521f76c: Pull complete 
dc9c4fdb83d6: Pull complete 
8056d2bcf3b6: Pull complete 
Digest: sha256:4c0fdaa8b6341bfdeca5f18f7837462c80cff90527ee35ef185571e1c327beac
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

3.1 映射端口

-p映射端口:容器外端口 -> 容器内端口
--rm,会在容器退出时,自动清除挂载的卷,以便清除数据

[root@server ~]# docker run --rm --name mynginx -d -p81:80 nginx

[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                               NAMES
97665eae03a1   nginx     "/docker-entrypoint.…"   9 minutes ago   Up 9 minutes   0.0.0.0:81->80/tcp, :::81->80/tcp   mynginx
[root@server ~]# 

访问Nginx

[root@server ~]# curl 127.0.0.1
curl: (7) Failed connect to 127.0.0.1:80; Connection refused
[root@server ~]# curl 127.0.0.1:81
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

3.2 挂载数据卷

3.2.1 自定义数据卷目录

-v 容器外目录:容器内目录

此时容器外目录的内容会直接显示在容器内目录中
容器内目录中若存在文件,则会被清空!

[root@server ~]# mkdir /html
[root@server ~]# touch /html/index.html

[root@server ~]# docker run -d --rm --name nginx_baidu -p 81:80 -v /html:/usr/share/nginx/html nginx
3c2492f1d1afee0f5d8d376c3e9991a5615138a78cd53875173d7f01fd3aeb0f

[root@server ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS                               NAMES
3c2492f1d1af   nginx     "/docker-entrypoint.…"   11 seconds ago   Up 10 seconds   0.0.0.0:81->80/tcp, :::81->80/tcp   nginx_baidu
[root@server ~]# 

[root@server ~]# docker exec -it nginx_baidu /bin/sh
# ls /usr/share/nginx/html
index.html

3.2.2 自动数据卷目录

[root@server ~]# docker run -d --rm --name nginx_baidu -p 81:80 -v aaa:/usr/share/nginx/html nginx

随意命名宿主机的目录名,此时Docker会在找不到该路径后,自动在/var/lib/docker/volumes/下创建数据卷,同时将容器内映射目录中的内容全部复制到该自动创建的数据卷目录中;多个容器可同时共享该数据卷。

3.3 传递环境变量

-e XXX=yyy

[root@server ~]# docker run --rm -e OPS=abcdef nginx printenv
HOSTNAME=dfb69fa2b394
HOME=/root
PKG_RELEASE=1~bookworm
NGINX_VERSION=1.25.3
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NJS_VERSION=0.8.2
OPS=abcdef
PWD=/

3.4 容器内安装软件

[root@server ~]# docker exec -it 3c2492f1d1af /bin/bash
root@3c2492f1d1af:/# apt-get install wget
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package wget       # 报错:无法找到wget软件,此时就需要更新update

root@3c2492f1d1af:/# apt-get update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8787 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [12.7 kB]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [134 kB]
Fetched 9185 kB in 3s (2632 kB/s)                         
Reading package lists... Done

root@3c2492f1d1af:/# apt-get install wget
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  wget
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 984 kB of archives.
After this operation, 3692 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 wget amd64 1.21.3-1+b2 [984 kB]
Fetched 984 kB in 2s (484 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package wget.
(Reading database ... 7590 files and directories currently installed.)
Preparing to unpack .../wget_1.21.3-1+b2_amd64.deb ...
Unpacking wget (1.21.3-1+b2) ...
Setting up wget (1.21.3-1+b2) ...

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1472320.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

机器学习理论知识学习

机器学习介绍 让机器有能力去根据数据学习 不是人类的if和else控制 机器学习分类 监督学习: 最成熟,落地案例最多。我们的视觉处理大多数都是监督学习。 小孩学习,类似监督学习,这是猫,这是狗,这是兔子 非监督学习:找到不同类型的数据,kmeans 聚类算法 帮助梳理不…

软考47-上午题-【数据库】-数据查询语言DQL2

一、聚合函数 聚合函数实现数据统计的功能&#xff0c;返回一个单一的值。聚合函数一般与select语句的group by子句一起使用。 示例&#xff1a; 二、数据分组-group by 聚合函数加上group by子句进行分组。 通常一个聚合函数的作用范围是满足where子句中指定条件的记录&…

【刷题】leetcode 1544.整理字符串

刷题 1544.整理字符串思路一&#xff08;模拟栈速解版&#xff09;思路二 &#xff08;原地算法巧解版&#xff09;思路三&#xff08;C栈版&#xff09; Thanks♪(&#xff65;ω&#xff65;)&#xff89;谢谢阅读&#xff01;&#xff01;&#xff01;下一篇文章见&#xff…

罗克韦尔AB的PLC实现ModbusTCP和ModbusRTU协议标签方式通讯

本文是通过IGT-DSER智能网关读写AB罗克韦尔Compact、Control系列PLC的标签数据缓存并转为Modbus从站协议&#xff0c;与上位机通讯的案例。 打开智能网关的参数软件(下载地址)&#xff0c;通过功能->数据转发与平台对接&#xff0c;再选择数据转发与缓存’&#xff0c;进入以…

探索Allure Report:提升自动化测试效率的秘密武器!

一.使用 Allure2 运行方式-Python # --alluredir 参数生成测试报告。 # 在测试执行期间收集结果 pytest [测试用例/模块/包] --alluredir./result/ (—alluredir这个选项 用于指定存储测试结果的路径)# 生成在线的测试报告 allure serve ./result二.使用 Allure2 运行方式-Ja…

Elasticsearch 创建index库 timeout

问题概述 使用 python 客户端 代码进行创建,【之前成功创建,但是现在出现报错,报错代码es_connection.client.indices.create】def create_vector_index(dataset_index_name,vector_query_field,query_field):es_connection = get_collention(dataset_index_name,vector_que…

Linux调用可执行程序:system()函数和execl函数

system()函数&#xff1a; system()函数是一个在C/C编程语言中的库函数&#xff0c;用于在操作系统中执行命令。 函数声明如下&#xff1a; int system(const char *command);该函数接受一个指向以空字符结尾的字符串的指针作为参数&#xff0c;该字符串包含要执行的命令。函…

福特锐界2021plus 汽车保养手册

福特锐界2021plus汽车保养手册两页&#xff0c;零部件保养要求&#xff0c;电子版放这里方便查询&#xff1a;

2024.02.23作业

1. 尝试处理普通信号 #include "test.h"#define MAXSIZE 128void handler(int signo) {if (SIGINT signo){printf("用户按下了 ctrl c 键\n");} }int main(int argc, char const *argv[]) {if (signal(SIGINT, SIG_IGN) SIG_ERR){perror("signal …

【C++】---内存管理new和delete详解

一、C/C内存分布 C/C内存被分为6个区域&#xff1a; &#xff08;1&#xff09; 内核空间&#xff1a;存放内核代码和环境变量。 &#xff08;2&#xff09;栈区&#xff1a;向下增长&#xff08;存放非静态局部变量&#xff0c;函数参数&#xff0c;返回值等等&#xff09; …

帧同步原理

帧同步和状态同步区别 状态同步&#xff1a;发操作&#xff0c;收状态 帧同步&#xff1a;发操作&#xff0c;收操作 逻辑严格排序 经常会有需要排序的列表或者数组&#xff0c;比如攻击距离自己最近的敌人&#xff0c;这时候就需要将身边的敌人进行距离排序&#xff0c;一般…

在having、select子句中使用子查询

目录 在having子句中使用子查询 统计出部门平均工资高于公司平均工资的部门编号、平均工资、部门人数 在select子句中使用子查询 查询每个员工的编号、姓名、职位、部门名称 Oracle从入门到总裁:https://blog.csdn.net/weixin_67859959/article/details/135209645 在havin…

2024.2.26

1、实现信号灯集 sem.c #include<myhead.h>union semun {int val; /* Value for SETVAL */struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */unsigned short *array; /* Array for GETALL, SETALL */struct seminfo *__buf; /* Buffer …

备考2025年考研数学(一)真题练习和解析——填空题

今天距离2025年考研预计还有10个月的时间&#xff0c;看起来挺长&#xff0c;但是对于备考2025年考研的同学来说&#xff0c;必须用好每一天。为了帮助大家提升考研数学一的成绩&#xff0c;我收集整理了1987-2024年的考研数学一的真题和解析&#xff0c;并把2015-2024年十年的…

一个39岁程序员的自白,大龄程序员的出路在哪里?

一个39岁程序员的自白&#xff0c;大龄程序员的出路在哪里&#xff1f; 大龄程序员&#xff0c;最悲惨的&#xff0c;可能是但凡你发个贴&#xff0c;下面就会有类似这种人来怼你 本文来自知乎一个大龄程序员老哥&#xff08;白圣君&#xff09;的自白&#xff0c;涤生哥已经经…

现在骨传导耳机什么牌子最好?专业选购指南与避坑策略

近些年来&#xff0c;耳机行业飞速发展&#xff0c;耳机已经成为日常生活中不可或缺的伙伴&#xff0c;无论是休闲时刻还是运动健身&#xff0c;耳机都伴随着我们。然而长时间使用传统的入耳式耳机可能会导致听力受损、容易脱落和不卫生等问题。为了解决这些问题&#xff0c;满…

【GameFramework框架内置模块】3、数据表(Data Table)

推荐阅读 CSDN主页GitHub开源地址Unity3D插件分享简书地址 大家好&#xff0c;我是佛系工程师☆恬静的小魔龙☆&#xff0c;不定时更新Unity开发技巧&#xff0c;觉得有用记得一键三连哦。 一、前言 【GameFramework框架】系列教程目录&#xff1a; https://blog.csdn.net/q7…

3 easy 26. 删除有序数组中的重复项

双指针&#xff1a; //给你一个 非严格递增排列 的数组 nums &#xff0c;请你 原地 删除重复出现的元素&#xff0c;使每个元素 只出现一次 &#xff0c;返回删除后数组的新长度。元素的 相对顺序 应该保持 //一致 。然后返回 nums 中唯一元素的个数。 // // 考虑 nums 的唯…

服务器防漏扫

什么是漏扫&#xff1f; 漏扫是漏洞扫描的简称。漏洞扫描是一种安全测试方法&#xff0c;用于发现计算机系统、网络或应用程序中的潜在漏洞和安全弱点。通过使用自动化工具或软件&#xff0c;漏洞扫描可以检测系统中存在的已知漏洞&#xff0c;并提供相关的报告和建议&#xf…

如何在Linux部署Portainer并结合内网穿透远程管理本地Docker容器

文章目录 前言1. 部署Portainer2. 本地访问Portainer3. Linux 安装cpolar4. 配置Portainer 公网访问地址5. 公网远程访问Portainer6. 固定Portainer公网地址 前言 Portainer 是一个轻量级的容器管理工具&#xff0c;可以通过 Web 界面对 Docker 容器进行管理和监控。它提供了可…