Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:8.14.0-alpine
COPY . /root
RUN npm install express mysql
CMD node /root/index.js
EXPOSE 3000
58 changes: 38 additions & 20 deletions answers.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
# Answers

Lastname:
Firstname:
YU:Daniel:

## 2.2
command:
command:sudo docker run app

## 2.3
question:
command:
question:the port is not opened
command:sudo docker run -p 3000:3000 app

## 2.5
question:
command:
question:We have to name the tag of the image to match the repository.
command:sudo docker login
sudo docker tag app yudada31/devops_lab
sudo docker push yudada31/devops_lab

## 2.6
command:
command:sudo docker prune -a

question:
command:
question:First, we need to pull the image: "sudo docker pull yudada31/devops_lab".
Then start a container again with the name I pushed on Docker hub
command:sudo docker create yudada31/devops_lab

command:
command:sudo docker run --detach yudada31/devops_lab

## 2.7
question:
question:
command:
question:by running the command "sudo docker ps -a", we can get a list of the container with its IDs, names, status and other informations. The status is up.
question:The name of the container is modest_feynman.
command:sudo docker ps -a

command:
command:sudo docker rename modest-feynman web_API

## 2.8
question:
output:
question:The OS of the container is Ubuntu.
output:DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic


## 3.1
command:
command:sudo docker-compose up

## 3.4
command:
command:
command:sudo docker-compose up -d
command:sudo docker-compose logs
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: '3'
services:
my-service:
image: yudada31/devops_lab
114 changes: 114 additions & 0 deletions express.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

'use strict';

/**
* Module dependencies.
*/

var bodyParser = require('body-parser')
var EventEmitter = require('events').EventEmitter;
var mixin = require('merge-descriptors');
var proto = require('./application');
var Route = require('./router/route');
var Router = require('./router');
var req = require('./request');
var res = require('./response');

/**
* Expose `createApplication()`.
*/

exports = module.exports = createApplication;

/**
* Create an express application.
*
* @return {Function}
* @api public
*/

function createApplication() {
var app = function(req, res, next) {
app.handle(req, res, next);
};

mixin(app, EventEmitter.prototype, false);
mixin(app, proto, false);

// expose the prototype that will get set on requests
app.request = Object.create(req, {
app: { configurable: true, enumerable: true, writable: true, value: app }
})

// expose the prototype that will get set on responses
app.response = Object.create(res, {
app: { configurable: true, enumerable: true, writable: true, value: app }
})

app.init();
return app;
}

/**
* Expose the prototypes.
*/

exports.application = proto;
exports.request = req;
exports.response = res;

/**
* Expose constructors.
*/

exports.Route = Route;
exports.Router = Router;

/**
* Expose middleware
*/

exports.json = bodyParser.json
exports.query = require('./middleware/query');
exports.static = require('serve-static');
exports.urlencoded = bodyParser.urlencoded

/**
* Replace removed middleware with an appropriate error message.
*/

var removedMiddlewares = [
'bodyParser',
'compress',
'cookieSession',
'session',
'logger',
'cookieParser',
'favicon',
'responseTime',
'errorHandler',
'timeout',
'methodOverride',
'vhost',
'csrf',
'directory',
'limit',
'multipart',
'staticCache'
]

removedMiddlewares.forEach(function (name) {
Object.defineProperty(exports, name, {
get: function () {
throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.');
},
configurable: true
});
});
Loading