Docker Community Forums

Share and learn in the Docker community.

Docker tutorial issues


(Mjwrazor) #1

Part1 shows how to create a username/repository:tag but it doesn’t say what the :tag should be. Should it always be :tag or should it be my version #. Or something else?

I am working through the part 3 of the docker get started tutorial. Everything was working great till I needed to test my swarm with curl localhost. The hostname never changes, which makes me believe that the swarm is not working. I run all the commands shown and get all the expected results except this.

Part 4 Again the swarm issue persists. I have created the vms but cannot access them from the url or with curl. Am I just missing something? There is a Note about something here but it doesn’t explain how to do this, do I even need to?

Running on Mac Sierra V 10.12.5

(Denis Roy) #2

Hello @mjwrazor,

The tags can be anything under the sun but is used mainly for version numbers.

More informations is needed to help you troubleshoot your swarm issue. Maybe you could post your Dockerfile and compose.yml in the forum in code blocks for us to look over.


(Mjwrazor) #3

I mean its exactly the same as the tutorial.

 iversion: "3"
     image: mjwrazor/repository:4
      replicas: 5
          cpus: "0.1"
          memory: 50M
        condition: on-failure
      - "80:80"
      - webnet


`# Use an official Python runtime as a base image
FROM python:2.7-slim

# Set the working directory to /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt

# Make port 80 available to the world outside this container

# Define environment variable

# Run when the container launches
CMD ["python", ""]`

There is no extension on the Dockerfile right?
I ran the commands in exact sequence given in the tutorial. I went back to do it again. When I make changes do I need to bump the tag an push every time? Or can I just make changes and only create a new tag when I want to? is exact copy of the tutorial code.

When I try docker swarm init after restarting I get

Error response from daemon: This node is already part of a swarm. Use "docker swarm l join another one.

(Denis Roy) #4

No extension, that’s correct.

Error response from daemon: This node is already part of a swarm. Use "docker swarm l join another one.

That happens when you run docker swarm init more than once. If you need to restart the tutorial, you must leave the initialized swarm with:

$ docker swarm leave --force

And then you may run docker swarm init again. You should then get the following output:

$ docker swarm init

  Swarm initialized: current node ({node_name}) is now a manager.

  To add a worker to this swarm, run the following command:

      docker swarm join \
      --token {token} \

  To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

And then you can try and deploy your app again

(Mjwrazor) #5

Still the same response. I only ever get the same container ID it never load balances. @denisroy. Fallowing the tutorial step by step. It shows I have 5 instances if I use docker stack ps getstartedlab using the browser or curl will only ever show the same string.

(Denis Roy) #6

Trying it on my end seems to work without a itch

Other than cleaning everything up and restarting I’m afraid I can’t be of any more counsel to you unfortunately.

docker stack rm {app(s)}
docker swarm leave --force
docker container rm {container(s)}
docker image rm {image(s)}

(Marconicolodi) #7

Im also having problems. It was working at part 2, but the part 3 which introduces docker swarm doesnt work. My docker-compose.yml and Dockerfile are the same as the tutorial. Im getting the usual connected refused at localhost:4000 and localhost:80.

I am using ubuntu 16.04. I have apache installed so it was using port 80, but i put down the apache service and the swarm still doenst work. The services are up though, because using comands like docker container ls, docker service ls, and docker inspect respond just like the tutorial. So i think its a port mapping issue.

(Nyonor) #8

Hi there! Part 3 “Services”… all is running and fine BUT why my service is SIGNIFICANTLY slower than my container?

Response from service:

curl -o /dev/null -s -w %{time_total}\\n  http://localhost

Response just from running container (tutorial part 2):

curl -o /dev/null -s -w %{time_total}\\n  http://localhost

So can anyone explain to me wtf? =)

(Pierrepathmotion) #9

Hello guys,

I ran in the same issue, I didn’t investigate too much yet but I was getting nothing out of localhost (hitting port 80).
So, if you want to progress in the tutorial, go in docker-compose.yml and change:

  • “80:80"

Then hit localhost:4000

I’ll update if I find something but I believe my port 80 might be busy handling something else

(Ianonymouz) #10

Had the same issue. Apparently, there is a bug where the port is still allocated:

So, I had to restart Docker. For Mac, literally, quit and start again.