请访问 最新版 已兼容 Mac M1

Run

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
docker run -it -d \
--name vs-db \
-p 31005:3306 \
--hostname vs-db \
-e "MYSQL_ROOT_PASSWORD=123456" \
mariadb:latest

docker run -it -d \
--name code-server \
-v /yourpath/www/html:/www/wwwroot/html \
-p 31001:8080 \
-p 31002:22 \
-p 31003:80 \
-p 31004:5050 \
--hostname code-server \
--link vs-db \
xrsec/code-server:arm

其他的配置参考 另外一篇文章
Refer to another article for other configurations

Thanks

View

image-20210212204844971

initialization

Make code-server

1
2
3
4
5
6
7
8
9
10
docker run -it -d \
--name code-server \
--hostname code-server \
--restart on-failure:3 \
-p "31001:8080" \
-p "31002:22" \
-p "31003:8888" \
-p "31004:3306" \
-v "/code-server/www:/www/wwwroot" \
centos:latest /code-server.sh
1
2
3
4
5
6
7
echo -e '#!/bin/bash
echo "start code-server succers"
/bin/bash' > code-server.sh
sudo chmod 777 code-server.sh
sudo chown root code-server.sh
docker cp code-server.sh code-server:/
docker start code-server
1
docker exec -it code-server /bin/bash
1
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
1
2
3
4
5
6
7
yum makecache -y \
&& yum update -y \
&& yum install -y vim zsh openssh-server \
iputils net-tools make cmake gcc gcc-c++ \
libxml2 libxml2-devel git nodejs zip unzip \
wget \
&& yum upgrade
1
docker cp ~/.zshrc code-server:/root/

Install code-server

It seems that arm does not support proxychains,so So you need to download the package first

1
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
1
2
3
4
cd /root \
&& wget https://github.com/cdr/code-server/releases/download/v3.8.1/code-server-3.8.1-arm64.rpm \
&& rpm -ivh code-server-3.8.1-arm64.rpm \
&& rm code-server-3.8.1-arm64.rpm

Amd64

1
2
wget https://github.com/cdr/code-server/releases/download/v3.8.1/code-server-3.8.1-amd64.rpm
rpm -ivh code-server-3.8.1-amd64.rpm

Other code-server

Inatall BT

1
2
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
y

Loadding …

1
2
/usr/bin/code-server &
vi ~/.config/code-server/config.yaml

更多细节可以在另外一篇文章查看
More details can be found in another article

Server

1
2
3
4
5
6
7
echo -e '#!/bin/bash
/etc/rc.d/init.d/bt start &
echo "start bt succers"
/etc/rc.d/init.d/bt 14 &
/usr/bin/code-server &
echo "start code-server succers"
/bin/bash' > /code-server.sh
1
chmod 777 /code-server.sh
1
2
exit
docker restart code-server

访问 localhost:31001 和 localhost:31003
visit localhost:31001 And localhost:31003

SSH configuration

1
2
cat /etc/ssh/sshd_config
/usr/sbin/sshd -D &

Docker-compose

image-20210212202753564

Docker-compose.yml

version: "3"
services:
  code-server:
    hostname: code-server
    container_name: code-server
    build:
      context: server
      dockerfile: Dockerfile
    image: code-server:bt
    restart: on-failure:3
    ports:
        - "31001:8080"
        - "31002:22"
        - "31003:8888"
        - "31004:3306"
    volumes:
      - "./www:/www/wwwroot"

networks:
  default:

```ini

### config.yaml

.config/code-server/config.yaml

```ini
bind-addr: 0.0.0.0:8080
auth: password
password: passwd
cert: false

```ini

### .zshrc

```ini
# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples

source /etc/profile

setopt autocd              # change directory just by typing its name
#setopt correct            # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst     # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch           # hide error message if there is no match for the pattern
setopt notify              # report the status of background jobs immediately
setopt numericglobsort     # sort filenames numerically when it makes sense
setopt promptsubst         # enable command substitution in prompt

WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word

# hide EOL sign ('%')
PROMPT_EOL_MARK=""

# configure key keybindings
bindkey -e                                        # emacs key bindings
bindkey ' ' magic-space                           # do history expansion on space
bindkey '^[[3;5~' kill-word                       # ctrl + Supr
bindkey '^[[3~' delete-char                       # delete
bindkey '^[[1;5C' forward-word                    # ctrl + ->
bindkey '^[[1;5D' backward-word                   # ctrl + <-
bindkey '^[[5~' beginning-of-buffer-or-history    # page up
bindkey '^[[6~' end-of-buffer-or-history          # page down
bindkey '^[[H' beginning-of-line                  # home
bindkey '^[[F' end-of-line                        # end
bindkey '^[[Z' undo                               # shift + tab undo last action

# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # case insensitive tab completion

# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups       # ignore duplicated commands history list
setopt hist_ignore_space      # ignore commands that start with space
setopt hist_verify            # show command with history expansion to user before running it
#setopt share_history         # share command history data

# force zsh to show the complete history
alias history="history 0"

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
 # We have color support; assume it's compliant with Ecma-48
 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
 # a case would tend to support setf rather than setaf.)
 color_prompt=yes
    else
 color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PROMPT=$'%F