Create a web environment quickly using Docker


I've been coming without touching Docker for a long time, but recently I've been trying various things, feeling the atmosphere that seems to be used for deep learning. Then, in the current project, I wanted to set up a Web server and verify it, so I decided to build an environment with Docker, so that's a memo.

By the way, I was a little addicted to mounting the directory on the host side when trying to do it in a Windows environment, so it is mainly a memo.

For this memo, I referred to the following article.

-Set up a web server with Docker and create a verification environment

Start container

Starting a container is very simple.

Start container

#Start Docker container
$ docker container run --name web -d -p 8888:80 -v $(pwd):/usr/share/nginx/html nginx:alpine

In the article I referred to, the command was written as above, but in Windows the path on the host side of the argument passed to -v had to be described as follows.

It was written at the end of this article.

-Start docker for windows

Starting a container on Windows

$ docker container run --name web -d -p 8888:80 -v D:/path/to/docker/nginx/html:/usr/share/nginx/html nginx:alpine

The meanings of the command arguments are as follows.

container                        #Subcommands for container operations
run                              #Start container
--name <container-name>          #Container name
-d                               #Start the container in the background (d of detach)
-p <host-port>:<container-port>  #Port forwarding of host port and container port
-v <host_path>:<container_path>> #Mount the host volume in a container
nginx:alpine                     #Image name of container

Stop and delete containers

Stop and delete containers

$ docker container stop web

$ docker container rm web

Confirmation of mount information, etc.

$ docker inspect $(doker ps -q)

$ (docker ps -q) will return the ID of the running container.

Other referenced articles

--Mount the host machine's directory in the Docker container / Check the mounted path

Recommended Posts

Create a web environment quickly using Docker
Create a Privoxy + Tor environment instantly using Docker
Create a Vue3 environment with Docker!
Create a MySQL environment with Docker from 0-> 1
[Memo] Create a CentOS 8 environment easily with Docker
Build a WordPress development environment quickly with Docker
Create a docker environment for Oracle 11g XE
Create a Spring Boot development environment with docker
Create a java web application development environment with docker for mac part2
Create a Java development environment using jenv on Mac
[Docker] Create Elasticsearch, Kibana environment!
Create a fortune using Ruby
[Note] Create a java environment from scratch with docker
[Docker] Build a Wordpress environment locally (Win, Mac) quickly
Try to build a Java development environment using Docker
[2021] Build a Docker + Vagrant environment for using React / TypeScript
I tried to create a padrino development environment with Docker
[Android] Create a calendar using GridView
Create a Jetty project using Eclipse
Build a Node.js environment with Docker
Create a lightweight STNS Docker image
Create a tomcat project using Eclipse
Create a database in a production environment
Create SolrCloud verification environment with Docker
Create a Java project using Eclipse
Create a filtering function using acts-as-taggable-on
Create Laravel environment with Docker (docker-compose)
Build a browser test environment using Capybara in the Docker development environment
Set up a Wordpress Docker environment without using the Worpdress image
Create a simple web application with Dropwizard
Build a PureScript development environment with Docker
Create Rails 6 + MySQL environment with Docker compose
Building a Kotlin development environment using SDKMAN
Build a WAS execution environment from Docker
Create Spring Boot-gradle-mysql development environment with Docker
Let's create a Java development environment (updating)
[Docker] Create Node.js + express + webpack environment with Docker
Create a RESTful API service using Grape
Build a Wordpress development environment with Docker
Docker Compact Manual (4: Create a custom image)
I made a bulletin board using Docker 1
Install Docker and create Java runtime environment
Create a prefectural select bar using active_hash
Create a login function using Swift's Optional
Build a simple Docker + Django development environment
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
How to quickly create a reverse proxy that supports HTTPS with Docker
How to build a Ruby on Rails environment using Docker (for Docker beginners)
Creating a java web application development environment with docker for mac part1
Try to create a browser automatic operation environment using Selenide in 5 minutes
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
How to migrate a web application created in a local docker environment to AWS
Build a development environment for Docker + Rails6 + Postgresql
[Android] Create a sliding menu without using NavigationView
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
Let's create a REST API using WildFly Swarm.
[Windows] [IntelliJ] [Java] [Tomcat] Create a Tomcat9 environment with IntelliJ
[Rails] How to create a graph using lazy_high_charts
Build a Laravel / Docker environment with VSCode devcontainer
Building a CICD pipeline using Docker (personal memorandum)
Kaggle environment construction using official Docker and vscode