Skip to content

zane-monster/nvim-nvchad-dockerize

Repository files navigation

my youtube channel YouTube Channel Views

Immutable Infrastructure For Development

用于开发的不可变基础设施

NeoVim nvchad arch linux

Support

Dockerfile Arch Linux Vim go protobuf javascript typescript html css3 json ESLint lua C C++ python bash Shell ninja

1 Build docker image

1. update the base image

```sh
docker images
docker pull archlinux:base-devel
docker images # list images again
# Remove all dangling images
docker image prune
```

2. build the image

```sh
docker build -f Dockerfile.dev.build -t zane/dev .
```

2 How to use this docker image

- create a docker volume if you want it

```sh
docker volume create nvim_red_duck
```

2.1 docker compose lifecycle

2.1.1 creating and starting a container

  1. the env file
  • rename .env.example to .env
  • fill .env file with your dir info.
  1. start docker compose services
cd nvim-nvchad-dockerize
# using .env file
docker-compose run --service-ports dev
# or using another env file
docker-compose --env-file <.env.example> run --service-ports dev

then, the nvim container is creaded and login the shell.

  1. connect to the container in other terms
# get the id of nvim container
docker ps -a
docker exec -it <the nvim container id> bash
  1. exit in the first term and docker rm ...

2.1.2 starting an exited container

docker start -ai <exited container id>
docker exec -it <running container id> bash

2.2 docker lifecycle without docker compose

2.2.1 start a new container in the first term

docker run -it -p 3000:3000 -p 4000:4000 -p 8000:8000 -p 9000:9000 -v c:\a:/home/nv/a -v c:\Users\username\.ssh:/home/nv/.ssh -v "//var/run/docker.sock:/var/run/docker.sock" zane/dev

sudo chmod 600 /home/nv/.ssh/config

2.2.2 start a exited container

docker start -ai <exited container id>

2.2.3 connect to the running container

docker exec -it <running container id> bash

# as root
docker exec -u 0  -it <running container id> bash

2.2.4 exit in the first term and docker rm ...

2.3 After a contain first running

2.3.1 init nvim

  1. start nvim, then :qa
  2. start nvim, then :checkhealth

2.3.2 update nvchad if you want

<lead> + u + u

2.3.3 Go to 5 Git info init

3 Arch linux notes

3.1 set mirrorlist

# in docker # as root
reflector -f 5 --country 'United States' --protocol https --sort rate  --download-timeout 2 --save /etc/pacman.d/mirrorlist

reflector -f 5 --country 'United States' \
--protocol https \
--sort rate \
--download-timeout 2 \
--completion-percent 100 \
--save /etc/pacman.d/mirrorlist

4 Docker volume backup

4.1 cp "old_volume" to "new_volume"

docker volume create --name new_volume

docker container run --rm -it \
           -v old_volume:/from \
           -v new_volume:/to \
           alpine ash -c "cd /from ; cp -av . /to"

5 Git info init

git init .

# change to the main branch
git config --global init.defaultBranch <main>
git branch -m <main>

# project settings, not globle
git config user.name <"monster">
git config user.email <"i@monster">
git remote -v

# edit the git settings file
git config --global --edit

using a key for git in shell

GIT_SSH_COMMAND="ssh -i ~/.ssh/a_private_key" git push origin main

6 Windows WSL2

6.1 restart WSL2 for vmmem process

  1. shoutdown WSL
wsl --shutdown
  1. then, docker-desk ask you restart the WSL2, or right click docker-desk icon and click restart.

6.2 free memeory >2GB by closing WSL2 and docker for other heavy app

  1. close docker desktop
  2. shoutdown WSL2

7 Windows 10

7.1 Install Neovim QT

  • neovim-qt

  • Maybe reinsall replace update it from old version of neovim-qt

  • Maybe remove nvchad first before reinstall neovim-qt

# windows
rd -r ~\AppData\Local\nvim
rd -r ~\AppData\Local\nvim-data
choco install neovim

7.2 Fix Windows 10 Port Error

7.2.1 Port Error

docker start -ai 590d

Error response from daemon: Ports are not available: exposing port TCP 127.0.0.1:4000 -> 0.0.0.0:0: listen tcp 127.0.0.1:4000: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

7.2.2 Restart Windws winnat for port error

Run comands as administrator

net stop winnat
net start winnat