Install docker on ubuntu and basic usage

Install docker on ubuntu and basic usage#

1. Installation#

Update the apt-get source to the latest version before installation###

apt-get update

Use the docker installation package that comes with ubuntu to install docker

apt-get install -y docker.io

Install the latest docker

curl -s https://get.docker.com|sh

ps: Download the docker installation webpage to the local and execute sh

Check the docker version after installation###

docker version

Two, docker basic commands##

Pull the mirror from the official warehouse###

docker pull [OPTIONS] NAME[:TAG]

NAME: Mirror name (can be queried in the official docker warehouse or NetEase Hive Center)

[ OPTIONS]: command options

[ TAG]: version, the default is the latest

View the local docker image###

docker images [OPTIONS] [REPOSITORY[:TAG]]

[ REPOSITORY]: Specify the name of the mirror (usually used when there are many local mirrors)

Run the docker image to become a container###

docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]

IMAGE: image name

[ COMMAND]: Run command

[ ARG]: The parameters that this command depends on

For example, run nginx in the background and specify the local port 8080 to map the default port 80 of nginx: docker run -d -p 8080:80 nginx

Run commands in a running container (for viewing the inside of the container)

docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

CONTAINER: container name or container ID

Such as: docker exec -it CONTAINER bash

Exit the container###

exit

Stop the running container###

docker stop CONTAINER

CONTAINER: Container ID

Build a mirror###

docker build -t .

. : Indicates to build the directory and Dockerfile in the current directory

Delete mirror

docker rm IMAGEID

Delete container###

docker rmi CONTAINERID

If the image is already running as a container, you must delete the container first to delete the image. To delete a container, stop the container first

Three, build a custom mirror##

Please refer to my other blog: https://www.cnblogs.com/javafucker/p/9871332.html

note##

Docker is developed by ubuntu, so it must be the most stable when running on ubuntu

Official docker warehouse: https://hub.docker.com/

Recommended Posts

Install docker on ubuntu and basic usage
Install docker on Ubuntu
Install Docker on ubuntu18.04
Install Docker on Ubuntu18
Docker practice (1): install Docker on Ubuntu 16.04
How to install and use Docker on Ubuntu 20.04
Install Docker on Ubuntu 18.04 offline
How to install and use Docker on Ubuntu 16.04
Install and configure MySQL on Ubuntu
Install and configure Docker in Ubuntu
Docker ubuntu: install python-PIL-image environment on 14.04
ubuntu18.04 install docker
docker install ubuntu
Install Gnome and VNC on Ubuntu Server
How to install Docker Compose on Ubuntu 18.04
Install fonts on Ubuntu and switch default fonts
Install and uninstall CUDA and CUDNN on Ubuntu
Linux install Docker and run Ubuntu system
Install Docker on Centos7
install vscode on ubuntu18
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install nodejs10 on Ubuntu16
Install mysql on Ubuntu 14.04
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
Install Python3 on Ubuntu 14.04
Install rJava on Ubuntu18
Install JDK10+ on Ubuntu
Install Python3 on Ubuntu 16.04
Install KDE on Ubuntu16.04.2
install Docker on centos6.5
Install Python3.7 on Ubuntu
Install flashplayer on Ubuntu
How to install Prometheus with Docker on Ubuntu 14.04
How to install Pycharm and Ipython on Ubuntu 16.04/18.04
How to install and configure NATS on Ubuntu 16.04
Install JDK and configure environment variables on Ubuntu 16.04
How to install and configure Gogs on Ubuntu 18.04
How to install and use Docker on CentOS 7
How to install and configure Cyberpanel on Ubuntu 18.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure Ansible on Ubuntu 18.04
How to install and use Composer on Ubuntu 18.04
How to install and use Wine on Ubuntu 18.04
How to install and secure phpMyAdmin on Ubuntu 16.04
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install and use Composer on Ubuntu 20.04
How to install and use BaasBox on Ubuntu 14.04
How to install and configure VNC on Ubuntu 18.04
How to install and configure Sphinx on Ubuntu 16.04
How to install and configure OrientDB on Ubuntu 14.04
How to install and use PostgreSQL on Ubuntu 16.04
How to install and configure AppScale on Ubuntu 12.04
How to install and configure PostGIS on Ubuntu 14.04
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Install QQ robot on Ubuntu 16.04