Command to try using Docker for the time being

Overview

In this article, I made a note of how to use Docker when I wanted to use it for the time being.

Execution environment

Create a Docker Hub account

https://hub.docker.com/ You can create an account from this page.

Log in to Docker Hub

input


$ docker login

Enter the created user name and password

out


Login Succeeded

Pull image from Docker Hub Library

input


$ docker pull {image name}

hello-For world


latest: Pulling from library/hello-world
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5
Status: Image is up to date for hello-world:latest
docker.io/library/hello-world:latest

Create a container from image and enter inside the container (if you just want to run it, you don't need -it)

input


$ docker run -it {image name}

Exit the container

input


$ exit

Exit with the container active

ctrl + p + q

View the container list

input


$ docker ps -a

out


CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
c48468f185c5        ubuntu              "/bin/bash"         26 hours ago        Exited (255) 20 minutes ago                       priceless_khayyam

View Local repository

input


$ docker images

out


REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
ubuntu                   latest              4e2eef94cd6b        2 weeks ago         73.9MB

Reactivate the container whose Status is Exited

input


$ docker restart {Container name}

You can confirm that STATUS is "UP ~ seconds" by pressing "docker ps -a" again.

Re-enter the launched container

input


$ docker exec -it {Container name}

commit and save the container as a new image

input


$ docker commit {Container name} {New image name}

You can check it with docker images.

Push image to Docker Hub

input


$ docker tag {Old image name:Old tag} {New image name:New tag}

Build image from Dockerfile (in the folder where Dockerfile is)

input


$ docker build .

Recommended Posts

Command to try using Docker for the time being
I tried using Docker for the first time
Try running Spring Cloud Config for the time being
Introduction to java for the first time # 2
For the time being, run the war file delivered in Java with Docker
Glassfish tuning list that I want to keep for the time being
I tried touching Docker for the first time
Install Amazon Corretto (preview) for the time being
Use Java external library for the time being
Push the image to docker hub using Jib
Run Dataflow, Java, streaming for the time being
3 Tips to Improve Lead Time for Docker Build
I'm sorry to install JDK9 on my PC, but I'd like to try JShell for the time being.
The story of intentionally using try catch for the first time in my life
I want you to use Scala as Better Java for the time being
Try connecting to AzureCosmosDB Emulator for Docker with Java
Try to build a Java development environment using Docker
How to study kotlin for the first time ~ Part 2 ~
How to study kotlin for the first time ~ Part 1 ~
A memo to do for the time being when building CentOS 6 series with VirtualBox
Try using letter_opener_web for inquiries
Decomposing the Docker run command. .. ..
People using docker Try using docker-compose
[Rails] I tried using the button_to method for the first time
Hello World with Ruby extension library for the time being
Wait for the container service to start with docker healthcheck
I tried to build the environment little by little using docker
Try Spark Submit to EMR using AWS SDK for Java
How to create a jar file or war file using the jar command
Java14 came out, so I tried record for the time being
[Java] Try to solve the Fizz Buzz problem using recursive processing
Spring Boot for the first time
Articles referred to for incorporating Docker
[Java] Try to implement using generics
Try using the messaging system Pulsar
How to build CloudStack using Docker
[Ruby on Rails] When logging in for the first time ・ How to split the screen in half using jQuery
Instructions for installing and using the AWS command line (awscli) on CentOS
How to place geckodriver (Selenium WebDriver) on the path using Maven command
Building a DLNA server on Ubuntu (just move for the time being)
Java12 came out, so I tried the switch expression for the time being
[Using Eclipse] Precautions when moving the workspace being created to another PC
Wait for PostgreSQL to start with Docker and then start the WEB service
I want to display the number of orders for today using datetime.
How to build a Ruby on Rails environment using Docker (for Docker beginners)
[First Java] Make something that works with Intellij for the time being
After summarizing the virtualization plan, let's think about using Docker for business
The story of releasing the Android app to the Play Store for the first time.
Try running React Navigation v5 demo app using Docker + Expo (For Mac)
Try Alfresco 6.0 on Windows (Docker will be introduced at the same time)
Try using || instead of the ternary operator
Let's specify the version when using docker
Investigate the replacement from Docker to Podman.
Try using the Stream API in Java
Try using the Rails API (zip code)
About the procedure for java to work
[Java] How to set the Date time to 00:00:00
Try changing the .erb file to .slim
Try using Kong + Konga with Docker Compose.
Try using the Emotion API from Android
Try the Docker environment on AWS ECS