Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build images filed by dockerfile #3

Open
yangyangpig opened this issue Mar 11, 2019 · 1 comment
Open

build images filed by dockerfile #3

yangyangpig opened this issue Mar 11, 2019 · 1 comment

Comments

@yangyangpig
Copy link

when i build a images by Dockerfile i will filled ,such as
Building identidock
Step 1/9 : FROM python:3.4
---> d5da2fe7f13b
Step 2/9 : RUN groupadd -r uwsgi && useradd -r -g uwsgi uwsgi
---> Running in 34708a9d7b29

it can not running

my dockerfile is

Last login: Sun Mar 10 11:30:21 on ttys000
liufuhongdeMBP:~ liufuhong$ ssh [email protected]
[email protected]'s password:
Last login: Sun Mar 10 11:34:09 2019 from 14.27.9.141

Welcome to Alibaba Cloud Elastic Compute Service !

[root@izwz992jfhfb2uvrr38n1pz ~]# ls
--advertise-client-urls pythoncode
[root@izwz992jfhfb2uvrr38n1pz ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cfae665ee052 redis "docker-entrypoint..." About an hour ago Up About an hour 6379/tcp inspiring_mirzakhani
0c02ad5adba2 redis "docker-entrypoint..." About an hour ago Up About an hour 6379/tcp myredis
[root@izwz992jfhfb2uvrr38n1pz ~]# docker attch cfae665ee052
docker: 'attch' is not a docker command.
See 'docker --help'
[root@izwz992jfhfb2uvrr38n1pz ~]# docker -h
Flag shorthand -h has been deprecated, please use --help

Usage: docker COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default "/root/.docker")
-D, --debug Enable debug mode
--help Print usage
-H, --host list Daemon socket(s) to connect to (default [])
-l, --log-level string Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Management Commands:
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
volume Manage volumes

Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.
[root@izwz992jfhfb2uvrr38n1pz ~]# docker attach cfae665ee052
root@cfae665ee052:/data# keys *
bash: keys: command not found
root@cfae665ee052:/data# redis-c
redis-check-aof redis-check-rdb redis-cli
root@cfae665ee052:/data# pwd
/data
root@cfae665ee052:/data# cd ..
root@cfae665ee052:/# ls
bin boot data dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@cfae665ee052:/# cd data/
root@cfae665ee052:/data# ls
root@cfae665ee052:/data# keys *[root@izwz992jfhfb2uvrr38n1pz ~]#
[root@izwz992jfhfb2uvrr38n1pz ~]#
[root@izwz992jfhfb2uvrr38n1pz ~]#
[root@izwz992jfhfb2uvrr38n1pz ~]#
[root@izwz992jfhfb2uvrr38n1pz ]# packet_write_wait: Connection to 47.106.120.121 port 22: Broken pipe
liufuhongdeMBP:
liufuhong$ ssh [email protected]
[email protected]'s password:
Last login: Sun Mar 10 12:57:43 2019 from 14.27.9.141

Welcome to Alibaba Cloud Elastic Compute Service !

[root@izwz992jfhfb2uvrr38n1pz ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cfae665ee052 redis "docker-entrypoint..." 5 hours ago Up 5 hours 6379/tcp inspiring_mirzakhani
0c02ad5adba2 redis "docker-entrypoint..." 5 hours ago Up 5 hours 6379/tcp myredis
[root@izwz992jfhfb2uvrr38n1pz ~]# docker run -it --name container-test -h CONTAINER -v /data debin /bin/bash
Unable to find image 'debin:latest' locally
Trying to pull repository docker.io/library/debin ...
/usr/bin/docker-current: repository docker.io/debin not found: does not exist or no pull access.
See '/usr/bin/docker-current run --help'.
[root@izwz992jfhfb2uvrr38n1pz ~]# docker run -it --name container-test -h CONTAINER -v /data debian /bin/bash
Unable to find image 'debian:latest' locally
Trying to pull repository docker.io/library/debian ...
latest: Pulling from docker.io/library/debian
22dbe790f715: Pull complete
Digest: sha256:72e996751fe42b2a0c1e6355730dc2751ccda50564fec929f76804a6365ef5ef
Status: Downloaded newer image for docker.io/debian:latest
root@CONTAINER:/# ls
bin data etc lib media opt root sbin sys usr
boot dev home lib64 mnt proc run srv tmp var
root@CONTAINER:/# cd data/
root@CONTAINER:/data# ls
main.go
root@CONTAINER:/data# cat main.go
package main

func main() {
fmt.println("this is a test");
}
root@CONTAINER:/data# [root@izwz992jfhfb2uvrr38n1pz ~]#
[root@izwz992jfhfb2uvrr38n1pz ~]#
[root@izwz992jfhfb2uvrr38n1pz ~]# ls
--advertise-client-urls pythoncode
[root@izwz992jfhfb2uvrr38n1pz ~]# docker ps -al
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
afebb2c36c1a debian "/bin/bash" 43 minutes ago Up 43 minutes container-test
[root@izwz992jfhfb2uvrr38n1pz ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
afebb2c36c1a debian "/bin/bash" 43 minutes ago Up 43 minutes container-test
cfae665ee052 redis "docker-entrypoint..." 6 hours ago Up 6 hours 6379/tcp inspiring_mirzakhani
0c02ad5adba2 redis "docker-entrypoint..." 6 hours ago Up 6 hours 6379/tcp myredis
[root@izwz992jfhfb2uvrr38n1pz ~]# docker kill afebb2c36c1a
afebb2c36c1a
[root@izwz992jfhfb2uvrr38n1pz ]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
afebb2c36c1a debian "/bin/bash" 43 minutes ago Up 43 minutes container-test
cfae665ee052 redis "docker-entrypoint..." 6 hours ago Up 6 hours 6379/tcp inspiring_mirzakhani
0c02ad5adba2 redis "docker-entrypoint..." 6 hours ago Up 6 hours 6379/tcp myredis
[root@izwz992jfhfb2uvrr38n1pz ]# packet_write_wait: Connection to 47.106.120.121 port 22: Broken pipe
liufuhongdeMBP:
liufuhong$
liufuhongdeMBP:
liufuhong$ ssh [email protected]
[email protected]'s password:
Last login: Sun Mar 10 18:01:35 2019 from 27.46.135.117

Welcome to Alibaba Cloud Elastic Compute Service !

[root@izwz992jfhfb2uvrr38n1pz ~]# ls
--advertise-client-urls pythoncode
[root@izwz992jfhfb2uvrr38n1pz ~]# cd
[root@izwz992jfhfb2uvrr38n1pz ~]# ks
-bash: ks: command not found
[root@izwz992jfhfb2uvrr38n1pz ~]# ls
--advertise-client-urls pythoncode
[root@izwz992jfhfb2uvrr38n1pz ~]# pwd
/root
[root@izwz992jfhfb2uvrr38n1pz ~]# cd ..
[root@izwz992jfhfb2uvrr38n1pz /]# ls
bin dockerFile home lost+found opt root srv usr
boot etc lib media proc run sys var
dev github-repository lib64 mnt repositories sbin tmp
[root@izwz992jfhfb2uvrr38n1pz /]# cd dockerFile/
[root@izwz992jfhfb2uvrr38n1pz dockerFile]# ls
apache golang sshd_ubuntu
[root@izwz992jfhfb2uvrr38n1pz dockerFile]# tree identidock
identidock [error opening dir]

0 directories, 0 files
[root@izwz992jfhfb2uvrr38n1pz dockerFile]# mkdir -p identidock/app
[root@izwz992jfhfb2uvrr38n1pz dockerFile]# ls
apache golang identidock sshd_ubuntu
[root@izwz992jfhfb2uvrr38n1pz dockerFile]# cd identidock/
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app
[root@izwz992jfhfb2uvrr38n1pz identidock]# cd app/
[root@izwz992jfhfb2uvrr38n1pz app]# ls
[root@izwz992jfhfb2uvrr38n1pz app]# vim identidock.py
[root@izwz992jfhfb2uvrr38n1pz app]# ls
identidock.py
[root@izwz992jfhfb2uvrr38n1pz app]# ls
identidock.py
[root@izwz992jfhfb2uvrr38n1pz app]# cd ..
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app
[root@izwz992jfhfb2uvrr38n1pz identidock]# vim Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker build -t identidock .
Sending build context to Docker daemon 3.584 kB
Step 1/5 : FROM python:3.4
Trying to pull repository docker.io/library/python ...
3.4: Pulling from docker.io/library/python
22dbe790f715: Already exists
0250231711a0: Pull complete
6fba9447437b: Pull complete
c2b4d327b352: Pull complete
270e1baa5299: Pull complete
5b96c923e138: Pull complete
8d77947cb766: Pull complete
d0a02fe10585: Pull complete
3ba526bc70f7: Pull complete
Digest: sha256:a49b986e02af3f859b8843cfad9f0caed611f78debee8234c10c375c888529fd
Status: Downloaded newer image for docker.io/python:3.4
---> d5da2fe7f13b
Step 2/5 : RUN pip install Flask==0.10.1
---> Running in b02c6ba8aced

DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Collecting Flask==0.10.1
Downloading https://files.pythonhosted.org/packages/db/9c/149ba60c47d107f85fe52564133348458f093dd5e6b57a5b60ab9ac517bb/Flask-0.10.1.tar.gz (544kB)
Collecting Werkzeug>=0.7 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
Collecting Jinja2>=2.4 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
Collecting itsdangerous>=0.21 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/99/c9/5d5dcf2aa90f1d4500e92467a04f63b3708ee6e5764b40b2445e767ab8dc/MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl
Building wheels for collected packages: Flask
Building wheel for Flask (setup.py): started
Building wheel for Flask (setup.py): finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/e1/f2/be/1c4f307a41aad7e632f79c0242a2714ecde24b663da3519665
Successfully built Flask
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask
Successfully installed Flask-0.10.1 Jinja2-2.10 MarkupSafe-1.1.1 Werkzeug-0.14.1 itsdangerous-1.1.0

^C
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/python 3.4 d5da2fe7f13b 5 days ago 924 MB
docker.io/redis latest 0f88f9be5839 5 days ago 95 MB
docker.io/debian latest 0af60a5c6dd0 6 days ago 101 MB
docker.io/ubuntu latest cd6d8154f1e1 6 months ago 84.1 MB
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker run -d -p 5000:5000 identidock
Unable to find image 'identidock:latest' locally
Trying to pull repository docker.io/library/identidock ...
/usr/bin/docker-current: repository docker.io/identidock not found: does not exist or no pull access.
See '/usr/bin/docker-current run --help'.
[root@izwz992jfhfb2uvrr38n1pz identidock]#
[root@izwz992jfhfb2uvrr38n1pz identidock]#
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/python 3.4 d5da2fe7f13b 5 days ago 924 MB
docker.io/redis latest 0f88f9be5839 5 days ago 95 MB
docker.io/debian latest 0af60a5c6dd0 6 days ago 101 MB
docker.io/ubuntu latest cd6d8154f1e1 6 months ago 84.1 MB
[root@izwz992jfhfb2uvrr38n1pz identidock]# pwd
/dockerFile/identidock
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker build -t identidock .
Sending build context to Docker daemon 3.584 kB
Step 1/5 : FROM python:3.4
---> d5da2fe7f13b
Step 2/5 : RUN pip install Flask==0.10.1
---> Running in dde0047552dd

DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Collecting Flask==0.10.1
Downloading https://files.pythonhosted.org/packages/db/9c/149ba60c47d107f85fe52564133348458f093dd5e6b57a5b60ab9ac517bb/Flask-0.10.1.tar.gz (544kB)
Collecting Werkzeug>=0.7 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
Collecting Jinja2>=2.4 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
Collecting itsdangerous>=0.21 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/99/c9/5d5dcf2aa90f1d4500e92467a04f63b3708ee6e5764b40b2445e767ab8dc/MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl
Building wheels for collected packages: Flask
Building wheel for Flask (setup.py): started
Building wheel for Flask (setup.py): finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/e1/f2/be/1c4f307a41aad7e632f79c0242a2714ecde24b663da3519665
Successfully built Flask
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask
Successfully installed Flask-0.10.1 Jinja2-2.10 MarkupSafe-1.1.1 Werkzeug-0.14.1 itsdangerous-1.1.0
^C
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# cd app
[root@izwz992jfhfb2uvrr38n1pz app]# ls
identidock.py
[root@izwz992jfhfb2uvrr38n1pz app]# vim identidock.py
[root@izwz992jfhfb2uvrr38n1pz app]# cd ..
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker build -t identidock .
Sending build context to Docker daemon 4.608 kB
Step 1/5 : FROM python:3.4
---> d5da2fe7f13b
Step 2/5 : RUN pip install Flask==0.10.1
---> Running in c911d58ea5e0

DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Collecting Flask==0.10.1
Downloading https://files.pythonhosted.org/packages/db/9c/149ba60c47d107f85fe52564133348458f093dd5e6b57a5b60ab9ac517bb/Flask-0.10.1.tar.gz (544kB)
Collecting Werkzeug>=0.7 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
Collecting Jinja2>=2.4 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
Collecting itsdangerous>=0.21 (from Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.10.1)
Downloading https://files.pythonhosted.org/packages/99/c9/5d5dcf2aa90f1d4500e92467a04f63b3708ee6e5764b40b2445e767ab8dc/MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl
Building wheels for collected packages: Flask
Building wheel for Flask (setup.py): started
Building wheel for Flask (setup.py): finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/e1/f2/be/1c4f307a41aad7e632f79c0242a2714ecde24b663da3519665
Successfully built Flask
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask
Successfully installed Flask-0.10.1 Jinja2-2.10 MarkupSafe-1.1.1 Werkzeug-0.14.1 itsdangerous-1.1.0

^C
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]#
[root@izwz992jfhfb2uvrr38n1pz identidock]#
[root@izwz992jfhfb2uvrr38n1pz identidock]#
[root@izwz992jfhfb2uvrr38n1pz identidock]# vim Do
[root@izwz992jfhfb2uvrr38n1pz identidock]# vim Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# chmod +x cmd.sh
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker build -t identidock .
Sending build context to Docker daemon 4.608 kB
Step 1/9 : FROM python:3.4
---> d5da2fe7f13b
Step 2/9 : RUN groupadd -r uwsgi && useradd -r -g uwsgi uwsgi
---> Running in 013dd61b0d93

^C
[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh docker-compose.yml Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker-compose build
ERROR: In file './docker-compose.yml', service 'ports' must be a mapping not an array.
[root@izwz992jfhfb2uvrr38n1pz identidock]# vim docker-compose.yml
[root@izwz992jfhfb2uvrr38n1pz identidock]# vim docker-compose.yml
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker-compose build
ERROR: The Compose file './docker-compose.yml' is invalid because:
identidock.environment contains an invalid type, it should be an object, or an array
[root@izwz992jfhfb2uvrr38n1pz identidock]# docker-compose build
Building identidock
Step 1/9 : FROM python:3.4
---> d5da2fe7f13b
Step 2/9 : RUN groupadd -r uwsgi && useradd -r -g uwsgi uwsgi
---> Running in 34708a9d7b29

^CERROR: Aborting.

[root@izwz992jfhfb2uvrr38n1pz identidock]# ls
app cmd.sh docker-compose.yml Dockerfile
[root@izwz992jfhfb2uvrr38n1pz identidock]# vim Dockerfile

FROM python:3.4
RUN groupadd -r uwsgi && useradd -r -g uwsgi uwsgi
RUN pip install Flask==0.10.1 uWSGI==2.0.8
WORKDIR /app
COPY app /app
COPY cmd.sh /
EXPOSE 9090 9191
USER uwsgi
CMD ["/cmd.sh"]

please someone can tell me why,i will be very gratefully! thanks

@Philastrio
Copy link

Don't use uWSGI 2.0.8.
Use 2.0.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants