Learn about docker run with environment variables, we have the largest and most updated docker run with environment variables information on alibabacloud.com
/mysql stopexec/usr/bin/ Supervisord looks ugly. There is wood there, let me change the way, so that supervisor to run it and never restart. The actual init.sh script is as follows: #!/bin/bashret=1while [[Ret-ne 0]]; do sleep 1; Mysql-e ' exit ' >/dev/null 2>1; Ret=$?donedb_name=${db_name:-symfony}mysqladmin-u Root Create $DB _nameif [-N "$INIT"]; Then /srv/$INITfi
The script waits for MySQL to start, then creates the DB based on the
never reboot.
The actual init.sh script is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14-15 16
#!/bin/bash ret=1 while [[Ret-ne 0]]; do sleep 1; Mysql-e ' exit ' >/dev/null 2>1; Ret=$? Done Db_name=${db_name:-symfony} mysqladmin-u root Create $DB _name if [-N "$INIT"]; then/srv/$INIT fi
The script waits for MySQL to start, then creates DB based on the environment variable db_name, defaults to Symfony, finds the script to
"Mirror ID", how convenient to come. The last is the "initial command", which is a running script written above that encapsulates the commands that load environment variables and start the Tomcat service.When the above command is run, a long list of "container IDs" is immediately output, and we can docker ps view the
signal to a process.-T creates a virtual TTY for the container, which is used in conjunction with-I as a good base friend.-P tells the Docker daemon to publish all specified ports, in this case port 80.-V $PWD:/srv mounts The current directory to the/srv directory of the container. Mount a directory so that directory content is available to the destination mount point.Now you remember the db_name and INIT environ
usually not the latest version of Docker,If you want to install the latest version, you can go to the Docker website to download the installation.> Create a first docker imageThe general process for building a docker image is to create a container first,and modify the image in the container, configure the relevant
host, exposing 58080 ports to the outside, and can access the 8080 ports inside the container via the Docker bridge.
--name: Represents the container name and is named with a meaningful name.
The content of the Docker bridge needs to be supplemented with instructions. Actually, Docker builds a bridge between the host and the container, and we can use th
Catalogue [-]
Raw materials
Pre-conditions
Installing Docker
Practice
Download image
Start container
Install related software
Installing the JDK
Installing Tomcat
Setting environment variables
Writing Run scripts
Exit container
Create a Java Web image
Start t
starts the interactive mode, that is, STDIO (standard input and output) is connected to your current terminal. It is useful when you want to receive logs or send signals to processes.-T creates a virtual TTY for the container, which is usually used together with-I.-P tells the Docker daemon to publish all specified ports. In this example, port 80 is used.-V $ PWD:/srv mount the current directory to the/srv Directory of the container. Mount a director
The Docker Run command is used to run a new container, and starting a container requires a lot of information, so there are a lot of parameters to this command, and the parameters supported by the command are analyzed in detail today.
First look at the format of the command:
Usage:docker Run [OPTIONS] IMAGE [COMMAND]
access the 8080 ports inside the container via the Docker bridge.
--name: Represents the container name and is named with a meaningful name.
The content of the Docker bridge needs to be supplemented with instructions. Actually, Docker builds a bridge between the host and the container, and we can use the host IP address and port number to map the IP add
ASP. NET Core develops a docker deployment, which supports Docker deployment operations. We run the ASP. NET Core deployment on Docker.You may have seen Docker, and today we'll look at Docker's purpose and real-world scenarios.Docker's application scenario from Paas,paas is the Doc
run in the INIT environment variable and try to run it. The end of this article describes how to use these environment variables.Build and run an image
Everything is ready to go. We also need to build a Symfony Docker image and u
-i BusyBox Cat
Container identification
Name (--name)
You can name the container in three ways:
1. Use the UUID name ("f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778")
2. Use the UUID Short command ("f78375b1c487")
3. Use name ("Evil_ptolemy")
This UUID indicator is generated by Docker Deamon. If you do not specify--name when you execute Docker
mode" /root/run.sh , at which point the Tomcat console does not appear on the output terminal.
-p: Represents the port mapping of the host to the container, at which point the 8080 port inside the container is mapped to the 58080 port of the host, exposing 58080 ports to the outside, and can access the 8080 ports inside the container via the Docker bridge.
--name: Represents the container name and is named with a meaningful name.
The con
article describes how to use these environment variables.Build and run an image
Everything is ready to go. We also need to build a Symfony Docker image and use the docker build command:
$ cd docker-symfony$ docker build -t symfon
winner.The above winner is a permanent environment variable loaded in ~/.BASHRC, can we customize the TEMP environment variable? OK. This time, we run the a.sh script to do the child process of the current shell, as follows:[Email protected] desktop]$ export x= "defined in shell"[Email protected] desktop]$ vim a.sh[email protected] desktop]$ cat a.sh#! /bin/bash
+p, and then ctrl+q, can be kept in the background to run, using Docker PS can be queried, if you feel trouble, you can specify a name at run time:Docker run-i-T--name containername imagesNamed ContainerName, using Docker PS, you can query toWhen the container exits, the con
their software. In this process, they also use a variety of different tools to build and manage their environment. I wouldn't be surprised if I saw someone using Kubernetes as a management tool.Some people like to apply the latest technology to production, otherwise they will feel the work is boring. So when they see that their favorite open source storage solutions are being containerized, they will be happy with the way they are "all containerized.
Image:After the Docker installation was successful, we went to the Docker hub to find the dotnet core base image (https://hub.docker.com/r/microsoft/dotnet/) that was maintained by Microsoft. Execute the following command to pull the image locally:Docker Pull Microsoft/dotnetAfter waiting for the image to be pulled to the local, we run the following command and
receive theThe first step in learning Docker technology based on ASP: Installing the Docker platform in CentOS7"This blog post, after the completion of the Docker platform, you can start to let the Aspdotnetcore program run on the Docker platform. 1. Prepare a ASPDOTNETCOREM
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.