优化openGauss官方容器源码(二)

本文涉及的产品
容器镜像服务 ACR,镜像仓库100个 不限时长
简介: 优化openGauss官方容器源码

三、新容器镜像制作

1. clone目录

[root@node3 dockerfiles]# cp -r 3.0.0/ 3.1.0
[root@node3 dockerfiles]# cd 3.1.0/
[root@node3 3.1.0]# ll
total 98812
-rw-r--r-- 1 root root     1373 Oct  9 09:43 dockerfile_amd
-rw-r--r-- 1 root root     1457 Oct  9 09:43 dockerfile_arm
-rw-r--r-- 1 root root    17730 Oct  9 09:43 entrypoint.sh
-rw-r--r-- 1 root root  2404352 Oct  9 09:43 gosu-amd64
-rw-r--r-- 1 root root  2490368 Oct  9 09:43 gosu-arm64
-rw-r--r-- 1 root root     1688 Oct  9 09:43 openEuler_aarch64.repo
-rw-r--r-- 1 root root 96246093 Oct  9 09:43 openGauss-3.0.0-CentOS-64bit.tar.bz2
-rw-r--r-- 1 root root      103 Oct  9 09:43 sha256_file_amd64
-rw-r--r-- 1 root root      106 Oct  9 09:43 sha256_file_arm64
[root@node3 3.1.0]# rm -f openGauss-3.0.0-CentOS-64bit.tar.bz2

2. 修改配置文件

  • dockerfile_amd
[root@ecs-lee 3.1.0]# cat dockerfile_amd
FROM centos:7.6.1810 as builder
RUN set -eux; \
    yum install -y \
    wget && \
    wget https://github.com/tianon/gosu/releases/download/1.14/gosu-amd64 && \
    wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/x86/openGauss-3.1.0-CentOS-64bit.tar.bz2
FROM centos:7.6.1810
COPY --from=builder /gosu-amd64  /usr/local/bin/gosu
#COPY gosu-amd64 /usr/local/bin/gosu
COPY --from=builder /openGauss-3.1.0-CentOS-64bit.tar.bz2 /tmp
#COPY openGauss-3.1.0-CentOS-64bit.tar.bz2 /tmp
COPY entrypoint.sh /usr/local/bin/
ENV LANG en_US.utf8
ENV PGDATA /var/lib/opengauss/data
RUN set -eux; \
    yum install -y \
    bzip2 \
    bzip2-devel \
    libaio-devel && \
    groupadd -g 70 omm;  \
    useradd -u 70 -g omm -m -s /bin/bash omm;  \
    mkdir -p /var/lib/opengauss && \
    mkdir -p /usr/local/opengauss && \
    mkdir -p /var/run/opengauss  && \
    mkdir /docker-entrypoint-initdb.d && \
    tar -xf /tmp/openGauss-3.1.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && \
    chown -R omm:omm /var/lib/opengauss /home/omm /var/run/opengauss /docker-entrypoint-initdb.d /usr/local/opengauss/ && \
    chmod 755 -R /usr/local/opengauss && \
    rm -f /tmp/openGauss-3.1.0-CentOS-64bit.tar.bz2 && \
    yum clean all && \
    echo "export GAUSSHOME=/usr/local/opengauss"  >> /home/omm/.bashrc && \
    echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && \
    echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc && \
    echo "export GAUSSLOG=/var/lib/opengauss/data/pg_log" >> /home/omm/.bashrc && \
    echo "export PGDATA=/var/lib/opengauss/data" >> /home/omm/.bashrc && \
    echo "\set PROMPT1 'openGauss%R%#'" >> /home/omm/.gsqlrc && \
    echo "\set PROMPT2 '#'" >> /home/omm/.gsqlrc && \
    echo "\set PROMPT3 '>'" >> /home/omm/.gsqlrc && \
    chown -R omm:omm /home/omm && \
    chmod +x /usr/local/bin/gosu && \
    chmod 755 /usr/local/bin/entrypoint.sh && \
    ln -s /usr/local/bin/entrypoint.sh /
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 5432
CMD ["gaussdb"]
  • entrypoint.sh
[root@ecs-lee 3.1.0]# cat entrypoint.sh
#!/usr/bin/env bash
set -Eeo pipefail
# usage: file_env VAR [DEFAULT]
#    ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
#  "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
export GAUSSHOME=/usr/local/opengauss
export PATH=$GAUSSHOME/bin:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
export LANG=en_US.UTF-8
export PGDATA=/var/lib/opengauss/data
file_env() {
        local var="$1"
        local fileVar="${var}_FILE"
        local def="${2:-}"
        if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
                echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
                exit 1
        fi
        local val="$def"
        if [ "${!var:-}" ]; then
                val="${!var}"
        elif [ "${!fileVar:-}" ]; then
                val="$(< "${!fileVar}")"
        fi
        export "$var"="$val"
        unset "$fileVar"
}
# check to see if this file is being run or sourced from another script
_is_sourced() {
        [ "${#FUNCNAME[@]}" -ge 2 ] \
                && [ "${FUNCNAME[0]}" = '_is_sourced' ] \
                && [ "${FUNCNAME[1]}" = 'source' ]
}
# used to create initial opengauss directories and if run as root, ensure ownership belong to the omm user
docker_create_db_directories() {
        local user; user="$(id -u)"
        mkdir -p "$PGDATA"
        chmod 700 "$PGDATA"
        # ignore failure since it will be fine when using the image provided directory;
        mkdir -p /var/run/opengauss || :
        chmod 775 /var/run/opengauss || :
        # Create the transaction log directory before initdb is run so the directory is owned by the correct user
        if [ -n "$POSTGRES_INITDB_XLOGDIR" ]; then
                mkdir -p "$POSTGRES_INITDB_XLOGDIR"
                if [ "$user" = '0' ]; then
                        find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
                fi
                chmod 700 "$POSTGRES_INITDB_XLOGDIR"
        fi
        # allow the container to be started with `--user`
        if [ "$user" = '0' ]; then
                find "$PGDATA" \! -user omm -exec chown omm '{}' +
                find /var/run/opengauss \! -user omm -exec chown omm '{}' +
        fi
}
# initialize empty PGDATA directory with new database via 'initdb'
# arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function
# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames
# this is also where the database user is created, specified by `GS_USER` env
docker_init_database_dir() {
        # "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary
        if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then
                export LD_PRELOAD='/usr/lib/libnss_wrapper.so'
                export NSS_WRAPPER_PASSWD="$(mktemp)"
                export NSS_WRAPPER_GROUP="$(mktemp)"
                echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
                echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP"
        fi
        eval $cmdbase
        # unset/cleanup "nss_wrapper" bits
        if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then
                rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP"
                unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
        fi
}
# print large warning if GS_PASSWORD is long
# error if both GS_PASSWORD is empty and GS_HOST_AUTH_METHOD is not 'trust'
# print large warning if GS_HOST_AUTH_METHOD is set to 'trust'
# assumes database is not set up, ie: [ -z "$DATABASE_ALREADY_EXISTS" ]
docker_verify_minimum_env() {
# set param
        cmdbase="gs_initdb "
                   echo -e "                        ********************************************************************************"
        if [ -n "$GS_XLOGDIR" ]; then
                cmdbase="$cmdbase --xlogdir=$GS_XLOGDIR"
                   echo -e "                        Message: GS_XLOGDIR is ${PGDATA}/xlog."
        else
                cmdbase="$cmdbase --xlogdir=$GS_XLOGDIR"
                GS_XLOGDIR=${PGDATA}/xlog
                   echo -e "                        Message: Default GS_XLOGDIR is ${PGDATA}/xlog."
        fi
        if [ -n "$GS_NODENAME" ]; then
                cmdbase="$cmdbase --nodename=$GS_NODENAME"
                   echo -e "                        Message: GS_NODENAME is ${GS_NODENAME}"
        else
                cmdbase="$cmdbase --nodename=opengauss"
                GS_NODENAME=opengauss
                   echo -e "                        Message: Default GS_NODENAME is ${GS_NODENAME}."
        fi
        if [ -n "$ENCODING" ]; then
                cmdbase="$cmdbase --encoding=$ENCODING"
                   echo -e "                        Message: ENCODING is ${ENCODING}"
        else
                cmdbase="$cmdbase --encoding=UTF-8"
                ENCODING=UTF-8
                   echo -e "                        Message: Default ENCODING is ${ENCODING}."
        fi
        if [ -n "$LOCALE" ]; then
                cmdbase="$cmdbase --locale=$LOCALE"
                   echo -e "                        Message: LOCALE is ${LOCALE}"
        else
                cmdbase="$cmdbase --no-locale"
                LOCALE=--no-locale
                   echo -e "                        Message: Default LOCALE is ${LOCALE}."
        fi
        if [ -n "$DBCOMPATIBILITY" ]; then
                cmdbase="$cmdbase --dbcompatibility=$DBCOMPATIBILITY"
                   echo -e "                        Message: DBCOMPATIBILITY is ${DBCOMPATIBILITY}"
        else
                cmdbase="$cmdbase --dbcompatibility=PG"
                DBCOMPATIBILITY=PG
                   echo -e "                        Message: Default DBCOMPATIBILITY is ${DBCOMPATIBILITY}."
        fi
        if [ -n "$GS_PASSWORD" ]; then
                cmdbase="$cmdbase --pwpasswd=$GS_PASSWORD"
                   echo -e "                        Message: GS_PASSWORD is ${GS_PASSWORD}"
        else
                randpw(){ < /dev/urandom tr -dc '^(.*[#?!@$%^&*-]).*$_A-Z-a-z-0-9' | head -c${1:-4};echo;}
                GS_PASSWORD=`randpw`"Aa1!"
                cmdbase="$cmdbase --pwpasswd=$GS_PASSWORD"
                   echo -e "                        Message: Default GS_PASSWORD is "${GS_PASSWORD}"."
        fi
                   echo -e "                        ********************************************************************************"
        cmdbase="$cmdbase -D $PGDATA"
        # check password first so we can output the warning before postgres
        # messes it up
        if [[ "$GS_PASSWORD" =~  ^(.{8,}).*$ ]] &&  [[ "$GS_PASSWORD" =~ ^(.*[a-z]+).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[A-Z]).*$ ]] &&  [[ "$GS_PASSWORD" =~ ^(.*[0-9]).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[#?!@$%^&*-+]).*$ ]]; then
                   echo -e "                        Message: The supplied GS_PASSWORD $GS_PASSWORD is meet requirements."
        else
                   echo -e "                                                Error: The supplied GS_PASSWORD $GS_PASSWORD is not meet requirements."
                 cat >&2 <<-'EOWARN'
                        Please Check if the password contains uppercase, lowercase, numbers, special characters, and password length(8).
                        At least one uppercase, lowercase, numeric, special character.
                        Example: Enmo@123
EOWARN
       exit 1
        fi
        if [ -z "$GS_PASSWORD" ] && [ 'trust' != "$GS_HOST_AUTH_METHOD" ]; then
                # The - option suppresses leading tabs but *not* spaces. :)
                cat >&2 <<-'EOE'
                        Error: Database is uninitialized and superuser password is not specified.
                               You must specify GS_PASSWORD to a non-empty value for the
                               superuser. For example, "-e GS_PASSWORD=password" on "docker run".
                               You may also use "GS_HOST_AUTH_METHOD=trust" to allow all
                               connections without a password. This is *not* recommended.
EOE
                exit 1
        fi
        if [ 'trust' = "$GS_HOST_AUTH_METHOD" ]; then
                cat >&2 <<-'EOWARN'
                        ********************************************************************************
                        WARNING: GS_HOST_AUTH_METHOD has been set to "trust". This will allow
                                 anyone with access to the opengauss port to access your database without
                                 a password, even if GS_PASSWORD is set.
                                 It is not recommended to use GS_HOST_AUTH_METHOD=trust. Replace
                                 it with "-e GS_PASSWORD=password" instead to set a password in
                                 "docker run".
                        ********************************************************************************
EOWARN
        fi
}
# usage: docker_process_init_files [file [file [...]]]
#    ie: docker_process_init_files /always-initdb.d/*
# process initializer files, based on file extensions and permissions
docker_process_init_files() {
        # gsql here for backwards compatiblilty "${gsql[@]}"
        gsql=( docker_process_sql )
        echo
        local f
        for f; do
                case "$f" in
                        *.sh)
                                if [ -x "$f" ]; then
                                        echo "$0: running $f"
                                        "$f"
                                else
                                        echo "$0: sourcing $f"
                                        . "$f"
                                fi
                                ;;
                        *.sql)    echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
                        *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
                        *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
                        *)        echo "$0: ignoring $f" ;;
                esac
                echo
        done
}
# Execute sql script, passed via stdin (or -f flag of pqsl)
# usage: docker_process_sql [gsql-cli-args]
#    ie: docker_process_sql --dbname=mydb <<<'INSERT ...'
#    ie: docker_process_sql -f my-file.sql
#    ie: docker_process_sql <my-file.sql
docker_process_sql() {
        local query_runner=( gsql -v ON_ERROR_STOP=1 --username "$GS_USER" --dbname postgres)
        echo "Execute SQL: ${query_runner[@]} $@"
        "${query_runner[@]}" "$@"
}
# create initial database
# uses environment variables for input: GS_DB
docker_setup_db() {
                 docker_process_sql --set passwd="$GS_PASSWORD" <<-'EOSQL'
                        create user opengauss with login password :"passwd" ;
                        CREATE DATABASE opengauss;
                        grant all privileges to opengauss;
                        ALTER USER opengauss MONADMIN;
EOSQL
}
docker_setup_user() {
        if [ -n "$GS_USERNAME" ]; then
                GS_DB= docker_process_sql  --set passwd="$GS_PASSWORD" --set user="$GS_USERNAME" <<-'EOSQL'
                        create user :"user" with login password :"passwd" ;
EOSQL
        else
                echo " default user is opengauss"
                   echo -e "                        Message: Default GS_USERNAME is ${GS_USERNAME}."
        fi
}
docker_setup_rep_user() {
        if [ -n "$SERVER_MODE" ] && [ "$SERVER_MODE" = "primary" ]; then
                GS_DB= docker_process_sql  --set passwd="$GS_PASSWORD" --set user="repuser" <<-'EOSQL'
                        create user :"user" SYSADMIN REPLICATION password :"passwd" ;
EOSQL
        else
                echo " default no repuser created"
        fi
}
# Loads various settings that are used elsewhere in the script
# This should be called before any other functions
docker_setup_env() {
        # default authentication method is md5
        : "${GS_HOST_AUTH_METHOD:=md5}"
        declare -g DATABASE_ALREADY_EXISTS
        # look specifically for OG_VERSION, as it is expected in the DB dir
        if [ -s "$PGDATA/PG_VERSION" ]; then
                DATABASE_ALREADY_EXISTS='true'
        fi
}
# append GS_HOST_AUTH_METHOD to pg_hba.conf for "host" connections
opengauss_setup_hba_conf() {
        {
                echo
                if [ 'trust' = "$GS_HOST_AUTH_METHOD" ]; then
                        echo '# warning trust is enabled for all connections'
                fi
                echo "host all all 0.0.0.0/0 $GS_HOST_AUTH_METHOD"
                if [ -n "$SERVER_MODE" ]; then
                    echo "host replication repuser $OG_SUBNET trust"
                fi
        } >> "$PGDATA/pg_hba.conf"
}
# append parameter to postgres.conf for connections
opengauss_setup_postgresql_conf() {
        {
                echo
                if [ -n "$GS_PORT" ]; then
                    echo "password_encryption_type = 1"
                    echo "port = $GS_PORT"
                    echo "wal_level = logical"
                else
                    echo '# use default port 5432'
                    echo "password_encryption_type = 1"
                    echo "wal_level = logical"
                fi
                if [ -n "$SERVER_MODE" ]; then
                    echo "listen_addresses = '0.0.0.0'"
                    echo "most_available_sync = on"
                    echo "remote_read_mode = non_authentication"
                    echo "pgxc_node_name = '$NODE_NAME'"
                    # echo "application_name = '$NODE_NAME'"
                    if [ "$SERVER_MODE" = "primary" ]; then
                        echo "max_connections = 100"
                    else
                        echo "max_connections = 100"
                    fi
                    echo -e "$REPL_CONN_INFO"
                    if [ -n "$SYNCHRONOUS_STANDBY_NAMES" ]; then
                        echo "synchronous_standby_names=$SYNCHRONOUS_STANDBY_NAMES"
                    fi
                else
                    echo "listen_addresses = '*'"
                fi
                if [ -n "$OTHER_PG_CONF" ]; then
                    echo -e "$OTHER_PG_CONF"
                fi
        } >> "$PGDATA/postgresql.conf"
}
opengauss_setup_mot_conf() {
         echo "enable_numa = false" >> "$PGDATA/mot.conf"
}
# start socket-only postgresql server for setting up or running scripts
# all arguments will be passed along as arguments to `postgres` (via pg_ctl)
docker_temp_server_start() {
        if [ "$1" = 'gaussdb' ]; then
                shift
        fi
        # internal start of server in order to allow setup using gsql client
        # does not listen on external TCP/IP and waits until start finishes
        set -- "$@" -c listen_addresses='127.0.0.1' -p "${PGPORT:-5432}"
        PGUSER="${PGUSER:-$GS_USER}" \
        gs_ctl -D "$PGDATA" \
                -o "$(printf '%q ' "$@")" \
                -w start
}
# stop postgresql server after done setting up user and running scripts
docker_temp_server_stop() {
        PGUSER="${PGUSER:-postgres}" \
        gs_ctl -D "$PGDATA" -m fast -w stop
}
docker_slave_full_backup() {
        gs_ctl build -D "$PGDATA" -b full
}
# check arguments for an option that would cause opengauss to stop
# return true if there is one
_opengauss_want_help() {
        local arg
        count=1
        for arg; do
                case "$arg" in
                        # postgres --help | grep 'then exit'
                        # leaving out -C on purpose since it always fails and is unhelpful:
                        # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
                        -'?'|--help|--describe-config|-V|--version)
                                return 0
                                ;;
                esac
                if [ "$arg" == "-M" ]; then
                        SERVER_MODE=${@:$count+1:1}
                        echo "openGauss DB SERVER_MODE = $SERVER_MODE"
                        shift
                fi
                count=$[$count + 1]
        done
        return 1
}
_main() {
        # if first arg looks like a flag, assume we want to run postgres server
        if [ "${1:0:1}" = '-' ]; then
                set -- gaussdb "$@"
        fi
        if [ "$1" = 'gaussdb' ] && ! _opengauss_want_help "$@"; then
                docker_setup_env
                # setup data directories and permissions (when run as root)
                docker_create_db_directories
                if [ "$(id -u)" = '0' ]; then
                        # then restart script as postgres user
                        exec gosu omm "$BASH_SOURCE" "$@"
                fi
                # only run initialization on an empty data directory
                if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
                        docker_verify_minimum_env
                        # check dir permissions to reduce likelihood of half-initialized database
                        ls /docker-entrypoint-initdb.d/ > /dev/null
                        docker_init_database_dir
                        opengauss_setup_hba_conf
                        opengauss_setup_postgresql_conf
                        opengauss_setup_mot_conf
                        # PGPASSWORD is required for gsql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
                        # e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS
                        export PGPASSWORD="${PGPASSWORD:-$GS_PASSWORD}"
                        docker_temp_server_start "$@"
                        if [ -z "$SERVER_MODE" ] || [ "$SERVER_MODE" = "primary" ]; then
                        docker_setup_user
                        docker_setup_rep_user
                        docker_setup_db
                        docker_process_init_files /docker-entrypoint-initdb.d/*
                        fi
                        if [ -n "$SERVER_MODE" ] && [ "$SERVER_MODE" != "primary" ]; then
                            docker_slave_full_backup
                        fi
                        docker_temp_server_stop
                        unset PGPASSWORD
                        echo
                        echo 'openGauss  init process complete; ready for start up.'
                        echo
                else
                        echo
                        echo 'openGauss Database directory appears to contain a database; Skipping initialization'
                        echo
                fi
        fi
        exec "$@"
}
if ! _is_sourced; then
        _main "$@"
fi
  • sha256_file_amd64
[root@ecs-lee 3.1.0]# cat sha256_file_amd64
9cf6f2762664d67889b4cd8d879c14a7f1dae70cff0552e4a7263a301b336115  openGauss-3.1.0-CentOS-64bit.tar.bz2


相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
1月前
|
存储 缓存 监控
Docker容器性能调优的关键技巧,涵盖CPU、内存、网络及磁盘I/O的优化策略,结合实战案例,旨在帮助读者有效提升Docker容器的性能与稳定性。
本文介绍了Docker容器性能调优的关键技巧,涵盖CPU、内存、网络及磁盘I/O的优化策略,结合实战案例,旨在帮助读者有效提升Docker容器的性能与稳定性。
111 7
|
2月前
|
弹性计算 运维 开发者
后端架构优化:微服务与容器化的协同进化
在现代软件开发中,后端架构的优化是提高系统性能和可维护性的关键。本文探讨了微服务架构与容器化技术如何相辅相成,共同推动后端系统的高效运行。通过分析两者的优势和挑战,我们提出了一系列最佳实践策略,旨在帮助开发者构建更加灵活、可扩展的后端服务。
|
3月前
|
存储 编译器 C++
【C++篇】揭开 C++ STL list 容器的神秘面纱:从底层设计到高效应用的全景解析(附源码)
【C++篇】揭开 C++ STL list 容器的神秘面纱:从底层设计到高效应用的全景解析(附源码)
85 2
|
5月前
|
运维 Kubernetes 开发者
使用容器化技术优化你的应用:从理论到实践
【8月更文挑战第7天】容器化技术通过提供一致的运行环境、高效的部署与扩展能力以及资源优化,为现代应用的开发和运维带来了显著的便利。通过本文的介绍,你应该对如何使用Docker来优化你的应用有了初步的了解。从编写Dockerfile到构建镜像,再到运行容器和使用Docker Compose管理多容器应用,每一步都是向更高效、更可靠的应用交付迈进的坚实步伐。
|
5月前
|
存储 缓存 监控
在Linux中,如何优化虚拟机和容器的性能和资源使用?
在Linux中,如何优化虚拟机和容器的性能和资源使用?
|
5月前
|
Dragonfly Docker 容器
实时数仓Hologres容器镜像问题之优化私有化部署如何解决
容器镜像常遇问题包括:将过多组件打包至单一容器、使用systemd导致状态不一致、私有部署中传输未优化的镜像包及基础镜像频繁下发致网络拥堵。应采用轻量化基础镜像,明确镜像版本,并利用镜像层复用来优化。[了解更多](https://developer.aliyun.com/ask/666077)。 避免容器臃肿的方法是选用精简基础镜像,固定镜像版本,并通过镜像层复用来减少重复内容,实现高效部署。[查看详情](https://developer.aliyun.com/ask/666078)。
61 0
|
5月前
|
数据采集 监控 Kubernetes
Job类日志采集问题之iLogtail以减小容器发现和开始采集的延时如何优化
Job类日志采集问题之iLogtail以减小容器发现和开始采集的延时如何优化
|
27天前
|
监控 NoSQL 时序数据库
《docker高级篇(大厂进阶):7.Docker容器监控之CAdvisor+InfluxDB+Granfana》包括:原生命令、是什么、compose容器编排,一套带走
《docker高级篇(大厂进阶):7.Docker容器监控之CAdvisor+InfluxDB+Granfana》包括:原生命令、是什么、compose容器编排,一套带走
190 77
|
1月前
|
监控 Docker 容器
在Docker容器中运行打包好的应用程序
在Docker容器中运行打包好的应用程序
|
8天前
|
Ubuntu Linux 开发工具
docker 是什么?docker初认识之如何部署docker-优雅草后续将会把产品发布部署至docker容器中-因此会出相关系列文章-优雅草央千澈
Docker 是一个开源的容器化平台,允许开发者将应用程序及其依赖项打包成标准化单元(容器),确保在任何支持 Docker 的操作系统上一致运行。容器共享主机内核,提供轻量级、高效的执行环境。本文介绍如何在 Ubuntu 上安装 Docker,并通过简单步骤验证安装成功。后续文章将探讨使用 Docker 部署开源项目。优雅草央千澈 源、安装 Docker 包、验证安装 - 适用场景:开发、测试、生产环境 通过以上步骤,您可以在 Ubuntu 系统上成功安装并运行 Docker,为后续的应用部署打下基础。
docker 是什么?docker初认识之如何部署docker-优雅草后续将会把产品发布部署至docker容器中-因此会出相关系列文章-优雅草央千澈