Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Basic operation of docker

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Remember: run with happiness, listen with heart, develop with thought, struggle with effort, measure with goal, live with love.

Install docker

Since the docker version in the apt official library may be old, uninstall the old version that may exist first:

# apt-get remove docker docker-engine docker-ce docker.io updates apt package index:

# apt-get update installs the following package to make the repository (repository) available to apt through HTTPS:

# apt-get install-y apt-transport-https ca-certificates curl software-properties-common add the official GPG key of Docker:

$curl-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add-use the following command to set up the stable repository:

# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable" and update the apt package index:

# apt-get update install the latest version of Docker CE:

# apt-get install-y docker-ce on production systems, you may need to install a specific version of Docker CE instead of always using the latest version:

List the available versions:

# apt-cache madison docker-ce installs a specific version, appends the version string to the package name, and separates them by the equal sign (=):

# apt-get install docker-ce= to check whether the docker service is started

# systemctl status docker

Lnmp environment

Pull the image to start the container in order

In each container, you need to update the source and then download the corresponding plug-in apt update apt install xxx

Mysql

Docker run-- name mysql-e MYSQL_ROOT_PASSWORD=123456-p 3306 MYSQL_ROOT_PASSWORD=123456-p 3306-d mysql if mysql login error authorization password problem can be added to skip password entry restart setting password restart password entry

Https://www.cnblogs.com/gumuzi/p/5711495.html

Php7.2

Docker run-- name php-p 9000 link mysql:mysql-d php:7.2-fpmnginx

Docker run-- name nginx-- link php:php-- link mysql:mysql-p 80:80-d nginx editing container

If the docker attach container is not established, the container can create two kinds of tasks without shell: backstage task and interactive task: # docker exec redis touch / testfile interactive task: # docker exec-it elated_lovelace / bin/bash root@68656158eb8e:/# ls

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report