Docker 容器创建命令

Docker 容器创建命令

安装docker

sudo apt-get install -y docker.io
systemctl start docker
systemctl enable docker

修改镜像源

vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://y0qd3iq.mirror.aliyuncs.com"]
}
systemctl restart docker

安装容器

  • Npc

    sudo docker run -d --name npc --net=host -v /mnt/c/config/npc:/conf ffdfgdfg/npc -config=/conf/npc.conf
  • HomeAssistant

    sudo docker run -d --name="home-assistant" --restart=unless-stopped --privileged=true -v /mnt/c/config/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant:latest
  • EMQX

    sudo docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 -v $PWD/etc:/opt/emqx/etc   emqx/emqx:latest
  • portainer

    sudo  docker run -d  -p 9900:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock  portainer/portainer-ce
  • ZigbeeToMqtt

    sudo docker run    -d    -v /mnt/c/config/zigbee2mqtt:/app/data     --net host  --name zigbee2mqtt   -v /run/udev:/run/udev:ro koenkk/zigbee2mqtt
  • ZigbeeGateway

    sudo docker run    -d    -v /mnt/c/config/zigbeeGateway:/app/data     -d -p 8580:8580  --name zigbeeGateway   -v /run/udev:/run/udev:ro koenkk/zigbee2mqtt
  • zigbee2mqttassistant

    sudo docker run  -d -p 6888:80 -e "Z2MA_SETTINGS__MQTTSERVER=192.168.8.120" -e "Z2MA_SETTINGS__MQTTUSERNAME=xhoobin" -e "Z2MA_SETTINGS__BASETOPIC=/gateway" -e  "Z2MA_SETTINGS__MQTTPASSWORD=2690hu??" --restart unless-stopped --name=zigbee2mqttAssistant carldebilly/zigbee2mqttassistant
  • transmission

    sudo docker run -d   --name=transmission   -e PUID=1000   -e PGID=1000   -e TZ=Asia/Shanghai   -e TRANSMISSION_WEB_HOME=/config/webui/    -e USER=xhoobin   -e PASS=2690hu??   -p 9091:9091   -p 51413:51413   -p 51413:51413/udp   -v /mnt/c/config/transmission:/config   -v /mnt:/downloads   -v /mnt/c/config/transmission/watch:/watch   --restart unless-stopped   linuxserver/transmission
  • rembg

    sudo docker run -d -v /mnt/c/data/rembg:/root/.u2net danielgatis/rembg:latest --name rembg
  • Ubuntu

    sudo docker run -itd -v /mnt/c/data/ubuntu:/data --name=ubuntu --network=macnet ubuntu
  • EspHome

    sudo docker run -d -p 6052:6052  --restart=always --name esphome -e ESPHOME_DASHBOARD_USE_PING=true -v /mnt/c/data/esphome:/config -it esphome/esphome
  • Mysql

    sudo docker run -d -p 3306:3306 --name mysql --restart=always \
    -v /mnt/c/data/mysql/conf:/etc/mysql \
    -v /mnt/c/data/mysql/logs:/var/log/mysql \
    -v /mnt/c/data/mysql/data:/var/lib/mysql \
    -v /mnt/c/data/mysql/mysql-files:/var/lib/mysql-files \
    -e MYSQL_ROOT_PASSWORD=2690hu?? mysql
    ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
    ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
    FLUSH PRIVILEGES; 
  • Mongod

    sudo docker run  -d  --name mongod -p 27017:27017  -v /mnt/c/data/mongodb:/etc/mongo -v /mnt/c/data/mongodb/data:/data/db   mongo --config /etc/mongo/mongod.conf
  • Node-RED

    sudo docker run -it -p 1880:1880 -v /mnt/c/data/nodered:/data --name "node-red" nodered/node-red
  • filebrowser

    sudo docker run \
      -d \
      -v /mnt/c:/srv \
      -v /mnt/c/data/filebrowser/filebrowser.db:/database.db \
      -v /mnt/c/data/filebrowser/.filebrowser.json:/.filebrowser.json \
      --user root:root \
      -p 9180:80 \
      --name "filebrowser" \
      filebrowser/filebrowser
  • kodexplorer

    sudo docker run -d -p 9280:80 --name kodexplorer -v /mnt/c/data/kodexplorer:/var/www/html -v /mnt:/data/ baiyuetribe/kodexplorer
  • VSCode

    sudo docker run -d -u root \
    -p 9380:8080 \
    --name vscode \
    -v /mnt/c/data/vscode/config.yaml:/root/.config/code-server/config.yaml \
    -v /mnt:/home/code \
    codercom/code-server
  • Emby

    sudo docker run -d \
      --name emby \
      --volume /mnt/c/data/emby:/config \
      --volume /mnt/f:/mnt/share1 \
      --volume /mnt/h:/mnt/share2 \
      --net=host \
      --publish 8096:8096 \
      emby/embyserver:latest
  • NginxWebUI

    sudo docker run -d -v /mnt/c/data/nginxWebUI:/home/nginxWebUI -e BOOT_OPTIONS="--server.port=8080" --privileged=true -p 9080:8080  --name nginxWebUI  cym1102/nginxwebui:latest
  • Nginx

    sudo docker run -d --name nginx  --net=host -v /data/web:/web -v /data/nginx/conf:/etc/nginx/conf.d -v /data/nginx/logs:/var/log/nginx nginx
  • redis

    sudo docker run -p 6379:6379 --name redis -v /data/redis/redis.conf:/etc/redis/redis.conf  -v /data/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes
  • influxDB

导出配置文件

m

运行docker

 docker run -d \
    --name influxdb \                   
    -p 8086:8086 \
    -v $PWD/conf/config.yml:/etc/influxdb2/config.yml \
    --volume $PWD/data:/var/lib/influxdb2 \
    influxdb:2.2.0

然后进入终端配置

docker exec -it influxdb /bin/sh

配置命令

influx setup

iOS编译Libevent库及踩坑例程

参考脚本

https://github.com/OnionBrowser/OnionBrowser/blob/master/build-libevent.sh

生成的库在dependencies路径下。

问题1

COULD NOT VERIFY PACKAGE SIGNATURE…

解决方案:

修改脚本中的 VERIFYGPG=false

问题2

configure: error: cannot run C compiled programs.

If you meant to cross compile, use `–host’.

See `config.log’ for more details

解决方案:

去掉模拟器架构,修改ARCHS=”armv7 arm64″

问题3

configure: error: openssl is a must but can not be found. You should add the directory containing openssl.pc' to thePKG_CONFIG_PATH’ environment variable, or set CFLAGS' andLDFLAGS’ directly for openssl, or use `–disable-openssl’ to disable support for openssl encryption

解决方案:

脚本中加入–disable-openssl,即修改为

./configure –disable-shared –enable-static –disable-debug-mode –disable-openssl ${EXTRA_CONFIG} \

修改后的完整脚本参考如下

#!/bin/bash

# Builds libevent for all five current iPhone targets: iPhoneSimulator-i386,

# iPhoneSimulator-x86_64, iPhoneOS-armv7, iPhoneOS-armv7s, iPhoneOS-arm64.

#

# Copyright 2012-2016 Mike Tigas <mike AT tig DOT as>

#

# Based on "build-libssl.sh" in OpenSSL-for-iPhone by Felix Schulze,

# forked on 2012-02-24. Original license follows:

# Copyright 2010 Felix Schulze. All rights reserved.

#

# Licensed under the Apache License, Version 2.0 (the "License");

# you may not use this file except in compliance with the License.

# You may obtain a copy of the License at

#

# http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

#

###########################################################################

# Choose your libevent version and your currently-installed iOS SDK version:

#

VERSION="2.1.12-stable"

USERSDKVERSION="15.5"

MINIOSVERSION="10.0"

VERIFYGPG=false

export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

###########################################################################

#

# Don't change anything under this line!

#

###########################################################################

# No need to change this since xcode build will only compile in the

# necessary bits from the libraries we create

#ARCHS="i386 x86_64 armv7 arm64"

ARCHS="armv7 arm64"

DEVELOPER=`xcode-select -print-path`

#DEVELOPER="/Applications/Xcode.app/Contents/Developer"

# for continuous integration

# https://travis-ci.org/mtigas/iOS-OnionBrowser

if [ "$1" == "--noverify" ]; then

VERIFYGPG=false

fi

if [ "$2" == "--travis" ]; then

ARCHS="i386 x86_64"

fi

if [[ ! -z "$TRAVIS" && $TRAVIS ]]; then

# Travis CI highest available version

echo "==================== TRAVIS CI ===================="

SDKVERSION="9.3"

else

SDKVERSION="$USERSDKVERSION"

fi

cd "`dirname \"$0\"`"

REPOROOT=$(pwd)

# Where we'll end up storing things in the end

OUTPUTDIR="${REPOROOT}/dependencies"

mkdir -p ${OUTPUTDIR}/include

mkdir -p ${OUTPUTDIR}/lib

BUILDDIR="${REPOROOT}/build"

# where we will keep our sources and build from.

SRCDIR="${BUILDDIR}/src"

mkdir -p $SRCDIR

# where we will store intermediary builds

INTERDIR="${BUILDDIR}/built"

mkdir -p $INTERDIR

########################################

cd $SRCDIR

# Exit the script if an error happens

set -e

if [ ! -e "${SRCDIR}/libevent-${VERSION}.tar.gz" ]; then

echo "Downloading libevent-${VERSION}.tar.gz"

curl -LO https://github.com/libevent/libevent/releases/download/release-${VERSION}/libevent-${VERSION}.tar.gz

fi

echo "Using libevent-${VERSION}.tar.gz"

# up to you to set up `gpg` and add keys to your keychain

# may have to import from link on http://www.wangafu.net/~nickm/ or http://www.citi.umich.edu/u/provos/

if $VERIFYGPG; then

if [ ! -e "${SRCDIR}/libevent-${VERSION}.tar.gz.asc" ]; then

curl -LO https://github.com/libevent/libevent/releases/download/release-${VERSION}/libevent-${VERSION}.tar.gz.asc

fi

echo "Using libevent-${VERSION}.tar.gz.asc"

if out=$(gpg --status-fd 1 --verify "libevent-${VERSION}.tar.gz.asc" "libevent-${VERSION}.tar.gz" 2>/dev/null) &&

echo "$out" | grep -qs "^\[GNUPG:\] VALIDSIG"; then

echo "$out" | egrep "GOODSIG|VALIDSIG"

echo "Verified GPG signature for source..."

else

echo "$out" >&2

echo "COULD NOT VERIFY PACKAGE SIGNATURE..."

exit 1

fi

fi

tar zxf libevent-${VERSION}.tar.gz -C $SRCDIR

cd "${SRCDIR}/libevent-${VERSION}"

set +e # don't bail out of bash script if ccache doesn't exist

CCACHE=`which ccache`

if [ $? == "0" ]; then

echo "Building with ccache: $CCACHE"

CCACHE="${CCACHE} "

else

echo "Building without ccache"

CCACHE=""

fi

set -e # back to regular "bail out on error" mode

export ORIGINALPATH=$PATH

for ARCH in ${ARCHS}

do

if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ];

then

PLATFORM="iPhoneSimulator"

EXTRA_CONFIG=""

else

PLATFORM="iPhoneOS"

EXTRA_CONFIG="--host=arm-apple-darwin14"

fi

mkdir -p "${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"

export PATH="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/:${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/usr/bin/:${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin:${DEVELOPER}/usr/bin:${ORIGINALPATH}"

export CC="${CCACHE}`which gcc` -arch ${ARCH} -miphoneos-version-min=${MINIOSVERSION}"

./configure --disable-shared --enable-static --disable-debug-mode --disable-openssl ${EXTRA_CONFIG} \

--prefix="${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" \

LDFLAGS="$LDFLAGS -L${OUTPUTDIR}/lib" \

CFLAGS="$CFLAGS -Os -I${OUTPUTDIR}/include -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk" \

CPPFLAGS="$CPPFLAGS -I${OUTPUTDIR}/include -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"

# Build the application and install it to the fake SDK intermediary dir

# we have set up. Make sure to clean up afterward because we will re-use

# this source tree to cross-compile other targets.

make -j$(sysctl hw.ncpu | awk '{print $2}')

make install

make clean

done

########################################

echo "Build library..."

# These are the libs that comprise libevent. `libevent_openssl` and `libevent_pthreads`

# may not be compiled if those dependencies aren't available.

OUTPUT_LIBS="libevent.a libevent_core.a libevent_extra.a libevent_openssl.a libevent_pthreads.a"

for OUTPUT_LIB in ${OUTPUT_LIBS}; do

INPUT_LIBS=""

for ARCH in ${ARCHS}; do

if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ];

then

PLATFORM="iPhoneSimulator"

else

PLATFORM="iPhoneOS"

fi

INPUT_ARCH_LIB="${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/${OUTPUT_LIB}"

if [ -e $INPUT_ARCH_LIB ]; then

INPUT_LIBS="${INPUT_LIBS} ${INPUT_ARCH_LIB}"

fi

done

# Combine the three architectures into a universal library.

if [ -n "$INPUT_LIBS"  ]; then

lipo -create $INPUT_LIBS \

-output "${OUTPUTDIR}/lib/${OUTPUT_LIB}"

else

echo "$OUTPUT_LIB does not exist, skipping (are the dependencies installed?)"

fi

done

for ARCH in ${ARCHS}; do

if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ];

then

PLATFORM="iPhoneSimulator"

else

PLATFORM="iPhoneOS"

fi

cp -R ${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/include/* ${OUTPUTDIR}/include/

if [ $? == "0" ]; then

# We only need to copy the headers over once. (So break out of forloop

# once we get first success.)

break

fi

done

####################

echo "Building done."

echo "Cleaning up..."

rm -fr ${INTERDIR}

rm -fr "${SRCDIR}/libevent-${VERSION}"

echo "Done."