Installing Docker Engine-Community#
1. Installation using Docker repository#
Before installing Docker Engine-Community for the first time on a new host, you need to set up the Docker repository. After that, you can install and update Docker from the repository.
- Set up the repository
Install the required packages. yum-utils provides yum-config-manager, and the device mapper storage driver requires device-mapper-persistent-data and lvm2.
- Use the following command to set up the stable repository.
2. Install Docker Engine-Community#
Install the latest version of Docker Engine-Community and containerd, or go to the next step to install a specific version. If prompted to accept the key, choose yes.
3. Start Docker#
4. Verify the installation of Docker Engine-Community by running the hello-world image.#
Installing nginx#
1. View official repository images#
2. Pull the image#
3. View the image#
xxxxxxxxxx # Copy copy path\filename path\filename # Move move path\filename path\filename PowerShell
4. Start the nginx image#
The --name nginx here is optional. It is used to name the nginx container.
5. Access the web page through the port#
Use the public IP address of the server followed by port 8080 to access.
If you don't see the content shown below in your browser at this step, it means that your server has not opened port 8080.
For example, in Alibaba Cloud, you can open port 8080 in the security group settings.
6. Nginx shutdown/startup#
Installing git and cloning the code#
Installation#
Git configuration#
The following is the key, copy it#
Open GitHub#
Now you can clone the code on the server#
Installing nvm on CentOS#
- Installation can be done using curl or wget. Use the following commands:
After installation, if you are using xshell to connect to the remote host, reconnect once, otherwise you will find that the nvm command cannot be found.
You may still see a message saying that the nvm command cannot be found. In that case, please use the source command as follows:
At this point, execute nvm to see if it is installed successfully.
Install yarn
Project packaging and deployment#
After normal git pull, execute the following commands#
Stop the docker container first#
Now you can access the project IP and successfully view it.
Simplify deployment commands with a script#
It can be cumbersome to execute commands to stop the container, pull the code, and start the container every time you write code. Create a file named start.sh in the root directory of the project.