- docker run
```shell $ docker pull ngnix Using default tag: latest Error response from daemon: pull access denied for ngnix, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied [node1] (local) root@192.168.0.23 ~ $ docker pull nginx Using default tag: latest latest: Pulling from library/nginx a076a628af6f: Pull complete 0732ab25fa22: Pull complete d7f36f6fe38f: Pull complete f72584a26f32: Pull complete 7125e4df9063: Pull complete Digest: sha256:10b8cc432d56da8b61b070f4c7d2543a9ed17c2b23010b43af434fd40e2ca4aa Status: Downloaded newer image for nginx:latest docker.io/library/nginx:latest [node1] (local) root@192.168.0.23 ~ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest f6d0b4767a6c 2 weeks ago 133MB [node1] (local) root@192.168.0.23 ~ $ docker run -d -p 80:80 nginx 9413525c79db1b113ae9daa0c1e9d0cb6eb3e7d9ab644185866929fc9c504765 [node1] (local) root@192.168.0.23 ~ $ dockerp s bash: dockerp: command not found [node1] (local) root@192.168.0.23 ~ $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9413525c79db nginx “/docker-entrypoint.…” 16 seconds ago Up 15 seconds 0.0.0.0:80->80/tcp pedantic_keldysh [node1] (local) root@192.168.0.23 ~ $ docker exec -it 94/bash “docker exec” requires at least 2 arguments. See ‘docker exec —help’.
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG…]
Run a command in a running container
[node1] (local) root@192.168.0.23 ~
$ docker exec -it 94 bash
root@9413525c79db:/# ls
bin dev docker-entrypoint.sh home lib64 mnt proc run srv tmp var
boot docker-entrypoint.d etc lib media opt root sbin sys usr
root@9413525c79db:/# cd usr/share/ngnix
bash: cd: usr/share/ngnix: No such file or directory
root@9413525c79db:/# cd usr/share/nginx
root@9413525c79db:/usr/share/nginx# ls
html
root@9413525c79db:/usr/share/nginx# cat html
cat: html: Is a directory
root@9413525c79db:/usr/share/nginx# cd usr/share/nginx/html
bash: cd: usr/share/nginx/html: No such file or directory
root@9413525c79db:/usr/share/nginx# cd /usr/share/nginx/html
root@9413525c79db:/usr/share/nginx/html# ls
50x.html index.html
root@9413525c79db:/usr/share/nginx/html# cat index.html
<!DOCTYPE html>
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to
nginx.org.
Commercial support is available at
nginx.com.
Thank you for using nginx.
root@9413525c79db:/usr/share/nginx/html# echo hello > index.html root@9413525c79db:/usr/share/nginx/html# cat index.html hello root@9413525c79db:/usr/share/nginx/html# vim Dockerfile bash: vim: command not found root@9413525c79db:/usr/share/nginx/html# vie Dockerfile bash: vie: command not found root@9413525c79db:/usr/share/nginx/html# wqbash: wq: command not found root@9413525c79db:/usr/share/nginx/html# exit exit [node1] (local) root@192.168.0.23 ~ $ vim Dockerfile [node1] (local) root@192.168.0.23 ~ $ vim index.html [node1] (local) root@192.168.0.23 ~ $ docker build -t m2 . Sending build context to Docker daemon 47MB Error response from daemon: dockerfile parse error line 1: unknown instruction: FORM [node1] (local) root@192.168.0.23 ~ $ vim Dockerfile [node1] (local) root@192.168.0.23 ~ $ docker build -t m2 . Sending build context to Docker daemon 47MB Step 1/2 : FROM nginx —-> f6d0b4767a6c Step 2/2 : ADD ./ /usr/share/nginx/html —-> ec8afbcce407 Successfully built ec8afbcce407 Successfully tagged m2:latest ```