I have problems with installing nignx on Docker

Hello,

I can not install or start nignx on Docker in Manjaro. I got used to Ubuntu when I installed Docker and nignx. I have Docker and nignx installed.

  • sudo docker images:

    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    ubuntu              18.04               16508e5c265d        12 days ago         84.1MB
    ubuntu              latest              16508e5c265d        12 days ago         84.1MB
    hello-world         latest              2cb0d9787c4d        7 weeks ago         1.85kB
    
  • sudo docker ps

    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
    2980636e7970        ubuntu:18.04        "/bin/bash"         About an hour ago   Up 10 seconds                              suspicious_chandrasekhar
    9953fcc6cd88        ubuntu              "/bin/bash"         2 hours ago         Up 9 seconds        0.0.0.0:8080->80/tcp   kind_lamport
    588b4f2659b3        ubuntu:18.04        "/bin/bash"         2 hours ago         Up 9 seconds                               nostalgic_noether
    

Expected behavior:

docker run -i -t -p 8081:80 ubuntu/nignx /bin/bash
docker ps > resultado_id
var=$(cat resultado_id | cut -c1-12 | tail -n +2)
docker exec $var /etc/init.d/nginx start

Actual behavior:

$ docker run -i -t -p 8081:80 ubuntu/nignx /bin/bash
Unable to find image 'ubuntu/nignx:latest' locally
docker: Error response from daemon: pull access denied for ubuntu/nignx, repository does not exist or may require 'docker login'.
See 'docker run --help'.

$ sudo docker exec $var /etc/init.d/nginx start
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"9953fcc6cd88\": executable file not found in $PATH": unknown

Please, add the new tags: docker and nignx.

you have only a contener named ubuntu and not ubuntu/nginx (in docker ps) ! its not the same

nignx ? web serveur nginx is a service in some dockerfile/contener

Salut

Sorry, my professor expected me to install nignx into the container ubuntu.

Sounds like you need to read the lab script. :wink:

But it is exactly the script that my professors gave me:

docker run -i -t -p 8080:80 luizrosa/nginx:1.0 /bin/bash

docker ps > resultado_id
var=$(cat resultado_id | cut -c1-12 | tail -n +2)
docker exec $var /etc/init.d/nginx start

He asked me to replace luizrosa, which is his name, for ubuntu.

Spot the difference. :wink:

Hint

nginx vs nignx

(Also, pretty sure you should have TAs who are there to help with this sort of thing)

1 Like

Then still the same error:

$ sudo docker run -i -t -p 8081:80 ubuntu/nginx /bin/bash
[sudo] password for gusreis: 
Unable to find image 'ubuntu/nginx:latest' locally
docker: Error response from daemon: pull access denied for ubuntu/nginx, repository does not exist or may require 'docker login'.
See 'docker run --help'.

Have you actually created the Docker image before trying to run it? Otherwise it will download from the Docker Hub (and fail when you specify an image and tag which doesn't exist, in this case, ubuntu/nginx).

(Again, you should have TAs who will help with the specifics of this rather than asking on a forum with people who don't know what you're doing. If there's an issue with the lab script then fixing that will help everyone who takes the course rather than having a thread helping only you personally.)

Also, I'm pretty sure the FAQ states that we will not help with home/school work. :slight_smile:

What is that?
Well, you can name a container, this way you can specify it in docker exec.

Another thing is, why did you pipe the output to a file? you can work directly on the output of docker ps and instead of using cut with cutting chars you can select a field or switch to awk and select a field while "tailing" the output from the second line one this way:

docker ps | awk 'NR>1 {print $1}'

NR>1 will skip the first line, the equivalent of tail -n +2 while {print $1} will only show the first column, since the field separator is the default then you don't have to specify that (with -F).

If we want to follow your logic (can be very useful in many cases but not this one) I think it's better to go that way:

docker exec $(docker ps | awk 'NR>1 {print $1}') /etc/init.d/nginx start

Naming a docker container is done that way:

docker run … --name my_container

Hoping it suits your needs.

It was not a homework. What a foolish argument.

It seems that the problem is /etc/init.d/nginx start because it is exclusively Ubuntu command and not Arch command.

It depends on the docker container content, not the operating system you're running, in Arch it should be something like systemctl start nginx (or httpd, I can't remember).

This is not Ubuntu specific, this is systemv specific, systemv is pretty much obsolete and most modern operating system use systemd nowadays.

Then it is why he uses Ubuntu 14.04 which used systemv. He gave the wrong commands to all us during the class while he was teaching. Not a good teacher. An outdated person.

This statement says otherwise.

Then you interpreted wrongly. I could have said the professor gave us these commands during the class while he was teaching.

He did not send us making homework or school work. He did not know how to solve these commands in all our computers and he ended up calling a Linux IT technician during the class, to solve the problems of docker.

That still sounds like school work. :wink:

Anyhow - I'm glad the technical support people (who are paid to support your classes) got things working for the whole class and the professor (who is also paid to do this stuff).

Next time you might also consider sending a ticket or raising an issue with your technical support people directly. Especially if you're paying for your course in some way. :wink:

1 Like

OK, you can close the topic now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by