Server Side Swift with Kitura - Part 5: | Ray Wenderlich Videos

Let's set up Docker on your machine so that you can easily test your Kitura API on Linux and prepare it for deployment.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3770-server-side-swift-with-kitura/lessons/5

I have a mid-2010 MacBook that doesn’t support the Hypervisor Framework. As such, I can’t run Docker for the Mac. I can run the Docker Toolbox and have been able to use it with some other tutorials on this site.

When I setup the Docker containers with this tutorial, everything seems to work ok and I get the “Listening on port 8080” message after running the “docker run -it …” command. However, when I go to http://localhost:8080, I get an “unable to connect to server” message.

Any ideas on what to look for? I’ll do some more digging and see what I can find.

Thanks!

I was able to get things working! When I run the “Docker Quickstart Terminal” to start the Docker Toolbox, it shows the following message:

docker is configured to use the default machine with IP 192.168.99.100

After starting the EmojiJournalServer, I just connect to http://192.168.99.100:8080 and I get the Kitura landing page.

On to the next tutorial lesson!

1 Like

@rcasey Thank you for sharing the solution - much appreciated!

Trying to follow the video tutorial, however Im not able to pull the repo?

MacBook-Pro:EmojiJournalServer chrisleebeer$ docker run -it -p 8080:8080 -v $PWD:/root/starter-backend-swift-kitura -w /root/starter-backend-swift-kitura swift-kitura-run sh -c .build-ubuntu/release/Swift-Backend-Kitura
Unable to find image 'swift-kitura-run:latest' locally
docker: Error response from daemon: pull access denied for swift-kitura-run, repository does not exist or may require 'docker login'.

Must be doing something wrong.
Thanks in advance!

@dokun1 Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @chris - have you tried the runDocker shell script included with the course?

We use two docker containers for this server - one to build the application and spit out the executable, and one to run the compiled executable. You can either run the provided script to do both, or take a look at the contents to check how we’re doing this.

Let me know if this is helpful!

Provided link is not working!

@dokun1 Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @boersma! For now, use this: https://cognitiveclass.ai/courses/docker-essentials/

If you’re using MacOS and also use Homebrew then do not install with the .dmg. You’ll need/want to install the IBM Cloud CLI through Homebrew and it’ll fail because you already have Docker installed. To install the CLI and Docker run this command : brew cask install ibm-cloud-cli

For anyone having trouble with the ‘docker run -v …’ section, the issue is most likely that there is a space in the path coming from $PWD so the solution is to quote that parameter like so:

docker run -v “$PWD:/root/project” -w …